370B.md (2054B)
1 Source: https://codeforces.com/problemset/problem/370/B 2 3 B. Berland Bingo 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Lately, a national version of a bingo game has become very popular in Berland. There are *n* players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can have equal numbers. The card of the *i*-th player contains *m**i* numbers. 22 23 During the game the host takes numbered balls one by one from a bag. He reads the number aloud in a high and clear voice and then puts the ball away. All participants cross out the number if it occurs on their cards. The person who crosses out all numbers from his card first, wins. If multiple people cross out all numbers from their cards at the same time, there are no winners in the game. At the beginning of the game the bag contains 100 balls numbered 1 through 100, the numbers of all balls are distinct. 24 25 You are given the cards for each player. Write a program that determines whether a player can win the game at the most favorable for him scenario or not. 26 27 Input 28 29 The first line of the input contains integer *n* (1 ≤ *n* ≤ 100) — the number of the players. Then follow *n* lines, each line describes a player's card. The line that describes a card starts from integer *m**i* (1 ≤ *m**i* ≤ 100) that shows how many numbers the *i*-th player's card has. Then follows a sequence of integers *a**i*, 1, *a**i*, 2, ..., *a**i*, *m**i* (1 ≤ *a**i*, *k* ≤ 100) — the numbers on the *i*-th player's card. The numbers in the lines are separated by single spaces. 30 31 It is guaranteed that all the numbers on each card are distinct. 32 33 Output 34 35 Print *n* lines, the *i*-th line must contain word "YES" (without the quotes), if the *i*-th player can win, and "NO" (without the quotes) otherwise. 36 37 Examples 38 39 Input 40 41 ``` 42 3 43 1 1 44 3 2 4 1 45 2 10 11 46 ``` 47 48 Output 49 50 ``` 51 YES 52 NO 53 YES 54 ``` 55 56 Input 57 58 ``` 59 2 60 1 1 61 1 1 62 ``` 63 64 Output 65 66 ``` 67 NO 68 NO 69 ```