N = int(input()) num = [0]*(1<<12) for i in range(N): K,*C = map(int, input().split()) for j in range(1,1<