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.

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.

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.


-----Input-----

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.

It is guaranteed that all the numbers on each card are distinct.


-----Output-----

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.


-----Examples-----
Input
3
1 1
3 2 4 1
2 10 11

Output
YES
NO
YES

Input
2
1 1
1 1

Output
NO
NO

Difficulty: interview

Starter code:

Solutions:
n = int(input())
p = list()
for i in range(n):
	p.append(set([int(x) for x in input().split()[1:]]))
for i in range(n):
	for j in range(n):
		if i != j:
			if p[i].issuperset(p[j]):
				print("NO")
				break
	else:
		print("YES")



n = int(input())
a = []
for x in range(n):
    m1 = input()
    m = m1.split(' ')
    b = []
    c = 0
    for y in m:
        if(c!=0):
            b.append(int(y))
        c = c+1
    a.append(b)
#print(a)
for z in range(n):
    lis1 = a[z]
    #print("list considered is :")
    #print(lis1)
    flag = 3
    count = 0
    for m in a:
        if(z != count):
            if(set(m).issubset(set(lis1))):
                flag = 2
                #break
        count = count+1
    if(flag==2):
        print("NO")
    else:
        print("YES")       
    


n=int(input())

L=[]
for i in range(n):
    m=list(map(int,input().split()))
    m=m[1:]
    L.append(sorted(m))

Ans=["YES"]*n

for i in range(n):
    for j in range(n):
        if(i==j):
            continue
        ind=-1
        for x in range(len(L[j])):
            if(L[j][x]==L[i][0]):
                ind=x
                break
        if(ind==-1):
            continue
        e=0
        for x in range(ind,len(L[j])):
            if(L[j][x]==L[i][e]):
                e+=1
            if(e==len(L[i])):
                break
        if(e==len(L[i])):
            Ans[j]="NO"
for i in range(n):
    print(Ans[i])
        


def contiene(l, s, n, m):	
	j=0
	for i in range(n):
		x = l[i]
		while j<m and not l[i]==s[j]:
			j+=1
		
		if j==m and not i==n:
			return False
	
	return True
		
	
def __starting_point():	
	n = int(input())
	l = []
	m = []
	for i in range(n):
		s = [int(x) for x in input().split()]
		m.append( s[0] )
		l.append( s[1:] )
		l[i].sort()

	for i in range(n):
		canWin = True
		for j in range(n):
			if not j==i:
				if m[i]<m[j]:
					continue
				if contiene( l[j], l[i], m[j], m[i] ):
					canWin = False
					break
		
		if canWin:
			print('YES')
		else:
			print('NO')
			
	






















__starting_point()

n = int(input())
p = list()
for i in range(n):
    p.append(set([int(x) for x in input().split()[1:]]))
for i in range(n):
    for j in range(n):
        if i != j:
            if p[i].issuperset(p[j]):
                print("NO")
                break
    else:
        print("YES")

3

def readln(): return tuple(map(int, input().split()))

n, = readln()
lst = [set(readln()[1:]) for _ in range(n)]
for a in lst:
    print("YES" if len([1 for b in lst if len(a.union(b)) == len(a)]) == 1 else "NO")


n = int(input())
t, l, s = [0] * n, [0] * n, ['YES'] * n
for i in range(n):
    p = tuple(map(int, input().split()))
    t[i], l[i] = set(p[1: ]), p[0]
for i in range(n):
    for j in range(i + 1, n):
        if l[i] < l[j]:
            if all(k in t[j] for k in t[i]): s[j] = 'NO'
        else:
            if all(k in t[i] for k in t[j]): 
                if l[i] == l[j]: s[j] = 'NO'
                s[i] = 'NO'
print('\n'.join(s))

n = int(input())
s, t = ['YES'] * n, [set(map(int, input().split()[1: ])) for i in range(n)]
for i in range(n):
    for j in range(n):
        if i != j and t[i].issuperset(t[j]):
            s[i] = 'NO'
            break
print('\n'.join(s))

n = int(input())
a = []
m = []
p = []
mn = []
for i in range(n):
    b = list(map(int,input().split()))
    a.insert(i,b)
    #a.append(b)
    #m = m + [a[i][0]]
    m.append(a[i][0])
    a[i] = a[i][1:]
    mn.append(set(a[i]))
    p.append('YES')

for j in range(n):
    for i in range(n):
        if i != j:
            if mn[i] <= mn[j]:
                p[j]= 'NO'
                break

for i in range(n):
    print(p[i])
    


# -*- coding: utf-8 -*-

n = int(input())
cards = [[set(map(int, input().split()[1:])), i, True] for i in range(n)]

cards.sort(key=lambda x: len(x[0]))
for i in range(n-1, -1, -1):
    if not cards[i][2]:
        continue
    for j in range(0, i):
        if cards[j][0] == cards[i][0]:
            cards[j][2] = cards[i][2] = False
            break
        if cards[j][0] < cards[i][0]:
            cards[i][2] = False
            break

cards.sort(key=lambda x: x[1])
for card in cards:
    print('YES' if card[2] else 'NO')


n = int(input())
a = []
for i in range(n):
  a += [set(list(map(int, input().split()))[1:])]
for i in range(n):
  for j in range(n):
    if i != j and a[j] <= a[i]:
      print("NO")
      break
  else:
    print("YES")

def main():
    n = int(input())
    a = [set(map(int, input().split()[1:])) for _ in range(n)]

    res = [True] * n
    for i in range(n - 1):
        for j in range(i + 1, n):
            if a[i].issubset(a[j]):
                res[j] = False
            if a[i].issuperset(a[j]):
                res[i] = False
    print('\n'.join('YES' if i else 'NO' for i in res))


def __starting_point():
    main()


__starting_point()

k = int(input())
cards = []
res = []
for i in range(k):
    str = input()
    it = set(map(int,str.split(" ")[1:]))
    cards.append(it)
s = []
for i in cards:
    for j in cards:
        s.append(len(j.difference(i)))
    if s.count(0) != 1:
        print('NO')
    else:
        print('YES')
    s=[]

p = [set(list(map(int, input().split()))[1:]) for i in range(int(input()))]
for i, s in enumerate(p):
    print('YES' if all(i == i2 or not s2 <= s for i2, s2 in enumerate(p)) else 'NO')

p = [set(list(map(int, input().split()))[1:]) for i in range(int(input()))]
for i, s in enumerate(p):
    print('YES' if all(i == i2 or not s2 <= s for i2, s2 in enumerate(p)) else 'NO')

n = int(input())
a = []
for i in range(n):
    li = list(map(int, input().split()))
    a.append(set(li[1:]))
for i in range(n):
    s = a[i]
    joke = 1
    for j in range(n):
        t = a[j]
        if t <= s and i != j:
            joke = 0
            break
    print("YES" * joke + "NO" * (1 - joke))


def s():
    n = int(input())
    a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
    res = 0
    print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')
s()


n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')


n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')



n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')



n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')



n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')



n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')



n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')



n = int(input())
a = [set(list(map(int,input().split()))[1:])for _ in range(n)]
res = 0
print(*['YES'if sum(i.issubset(j)for i in a) == 1 else 'NO' for j in a],sep = '\n')