H. The Hard Question
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Dance parties at the programming school are quite unique.

The boys, numbered with natural numbers from $$$1$$$ to $$$n$$$, take turns approaching the girls to invite one of the girls who is not currently dancing. Specifically, the boy with number $$$1$$$ invites a partner first, followed by the boy with number $$$2$$$, and so forth. Naturally, a boy will only invite a girl he finds attractive, which means a boy might end up with no one to invite, and thus remain without a dance partner.

During their time between dances, when grouped without girls, the boys start to worry about the possibility that they may all end up without partners for the next dance. Your task is to help them determine the answer to this question.

Input

The first line of the input file contains two integers $$$n$$$ and $$$k$$$ ($$$2 \leq n, k \leq 50$$$) — the number of boys and the number of girls, respectively. Each of the following $$$n$$$ lines describes the preferences of the $$$i$$$-th boy: the integer $$$m_i$$$ (the number of girls he likes) followed by $$$m_i$$$ distinct integers from $$$1$$$ to $$$k$$$, representing the indices of these girls in ascending order.

The next line contains the number of inquiries $$$q$$$ ($$$1 \leq q \leq 1000$$$). Each of the following $$$q$$$ lines starts with the integer $$$t_j$$$ (the number of boys in a particular group), followed by $$$t_j$$$ distinct integers from $$$1$$$ to $$$n$$$, indicating the indices of the boys in ascending order.

Output

For each query, output a single line containing "Yes" if all boys in this group could end up without partners, and "No" otherwise.

Examples
Input
3 3
2 2 3
2 1 2
2 2 3
3
1 1
1 2
1 3
Output
No
No
Yes
Input
3 3
2 2 3
2 2 3
2 1 2
3
1 1
1 2
1 3
Output
No
No
No
Input
4 4
4 1 2 3 4
4 1 2 3 4
2 1 2
2 1 2
4
1 2
1 3
1 4
2 3 4
Output
No
Yes
Yes
Yes