SOLVE
LATER
Kamil and his friends are playing new board game Hibina. There are six types of playing cards in the game: yellow, green, blue, white, red and a wildcard. Each player has five cards, numbered 1 through 5, but the problem is that each player can't see his own cards. The only thing can be done is giving hints to other players.
Wildcard cards are very important in this game, so Kamil wants to know, which of his cards are wildcard, and which of them are not. It's difficult to distinguish wildcard cards from the ordinary ones, because wildcards are of each of other five colors, too.
The rule of doing a hint by player A to player B follows: a player chooses one of five colors, say $$x$$, such that B has at least one card of color $$x$$, including wildcards. This means that if player B has wildcard, A can choose any color. Then A points to all cards having color $$x$$. This will give an information to player B, that the cards, which A pointed to, are of color $$x$$, and others are not of color $$x$$.
You are given $$n$$ hints made to Kamil. Help him detecting which of his cards are definitely wildcard and which of them are definitely ordinary.
First line contains single integer $$n$$ — number of hints made to Kamil ($$0 \le n \le 20$$). Next $$n$$ lines describe hints. Each of these lines starts with an integer $$k$$ and a string $$x$$ — the number of pointed cards during this hint and an English color name in lowercase Latin characters. Then $$k$$ distinct numbers follow $$a_1, a_2, \ldots a_k$$ — which cards were pointed during this hint ($$1 \le a_i \le 5$$; $$a_i \ne a_j$$ for $$i \ne j$$).
Color names are yellow
, green
, blue
, white
and red
.
It is guaranteed that there exists a hand of cards, so that all hints are correct.
Print exactly 5 lines, per line for each card: line $$i$$ should contain YES
if card $$i$$ is definitely wildcard, NO
if it's definitely ordinary and UNDEFINED
if card $$i$$ can still be as wildcard as ordinary.
The following cards are possible in Kamil's hand: wildcard, green, red, wildcard, red.
Another testcase:
2
2 yellow 1 5
2 yellow 1 5
Answer is:
UNDEFINED
NO
NO
NO
UNDEFINED