Lisbeth Salander (one of the main characters of the famous trilogy Millennium) is a crack mathematician, and therefore she is considering enrolling in the FME. As she likes both men and women, and she knows the FME graph, she is curious to know if it is possible that all the affairs have been between people of opposite sex. Help her!
Input consists of several cases. Every case begins with the number of people , followed by the information of each one: the name, the number of his or her affairs, and the names of the corresponding people. Assume that all the names are different, that for every pair of names and , if is in the list of then exists and is in the list of , and that is never in the list of . Suppose , and that the total number of affairs is at most .
For every case, tell if it is possible that all the affairs have been between people of opposite sex.
Input
6 Alex 2 Felix Ivan Enric 2 Ivan Felix Ferran 1 Lander Lander 1 Ferran Ivan 2 Alex Enric Felix 2 Enric Alex 4 a 0 d 2 b c b 2 d c c 2 d b
Output
yes no