beecrowd | 2931

Suspicious Gifts

By Gerson Groth, URI BR Brazil

Timelimit: 2

Mrs. Claus is suspecting that Santa has several children scattered around the world. She has noticed some patterns between the gifts requested by the kids and those received. Even if she is not sure, she would like to check in detail all the kids who present those patterns in the gifts received. As there are many kids around the world, you have volunteered to help her with this task.

Mrs. Claus will provide the patterns she wants to investigate. That way, for each gift, she will provide a list of suspicious gifts that can be received. After providing the suspicious combinations, she will inform the desired/received gifts for each kid. To do this, write a program that says whether or not Mrs. Claus should check the kid.

NOTE: Gift names may contain spaces or hyphens.

Input

The input contains several test cases. Each test case starts with the number of combinations C (1 ≤ C ≤ 50) and the number of Kids K (1 ≤ K ≤ 1000). For each combination there will be a line containing the desired gift, followed by the number of suspicious gifts S (0 ≤ SC). Each of the following S lines will contain the name of one suspected gift.

Afterwards, we will have K lines each containing the desired gift followed by the received gift by the kid, separated by a semicolon (;).

The end of the input is determined by EOF.

Output

For each test case, print Y if Mrs. Claus should investigate or N, otherwise.

Input Sample Output Sample

3 2

LEGO

3

LEGO

Karaoke

Barbie

Karaoke

1

LEGO

Barbie

1

Barbie

LEGO;LEGO

Karaoke;Barbie

Y

N