N=int(input()) C=[0]*N for n in range(N): K,*c=map(int,input().split()) for k in range(K): c[k]-=1 C[n]|=1<