Xavier works at a company with employees (between 0 and ) and tasks to do (between 0 and ). Every task has a list of all the employees that can do it. Note that it is allowed that more than one employee does the same task, and that the same employee does more than one task. There are employees that are really lazy, and they will not work under any circumstances. Moreover, there are eccentric employees. Each such employee has a list of employees such that will only accept to work if at least one of the employees of his list also works. Under all those constraints, is it possible to do all the tasks of the company?
Input consists of several cases. Every case begins with and . Follow lines: the -th line starts with a number between 1 and , followed by a list of different employees that can do task . Follow and the lazy employees. Finally, we have information about the eccentricities: First we have , followed by lines, each one with an eccentric employee , a number between 1 and , followed by a list of the employees in ’s list (all different and ). Assume that and are between 1 and , , , and . The lazy and the eccentric employees are all different.
For each case, print “YES” if all the tasks can be done,
and “NO” otherwise.
Input
1 1 1 0 0 0 5 2 4 3 2 1 0 5 0 1 2 3 4 2 1 0 2 2 2 0 1 3 2 2 1 3 2 1 1 2 1 0 1 2 2 1 1 0 0 1 1
Output
YES NO YES