import sys #input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n = 19 c = [0] * n for i in range(n): que = na() for j in que[1:]: c[i] += 1<> k & 1: continue dp[j+(1<> k & 1) from fractions import Fraction #2D matrix def add(x,y): return x + y def mul(x, y): return x * y def mat_add(A, B, replace=False): assert len(A)==len(B) and len(A[0]) == len(B[0]) if not replace: A = [a.copy() for a in A] n = len(A) m = len(A[0]) for i in range(n): for j in range(m): A[i][j] = add(A[i][j], B[i][j]) return A def mat_mul(A,B): assert len(A[0]) == len(B) n = len(A) m = len(B[0]) p = len(A[0]) R = [[0 for j in range(m)]for i in range(n)] for i in range(n): for j in range(m): for k in range(p): R[i][j] = add(R[i][j],mul(A[i][k],B[k][j])) return R def mat_pow(A, x): assert len(A)==len(A[0]) n = len(A) R = [[0 for j in range(n)]for i in range(n)] while x > 0: if x&1: R = mat_mul(R, A) A = mat_mul(A,A) x >>= 1 return R def determinant(A, replace=False): if not replace: A = [a.copy() for a in A] n = len(A) res = 1 for i, a_i in enumerate(A): if a_i[i] == 0: for j in range(i+1, n): if A[j][i]: break else: return 0 A[i], A[j] = A[j], A[i] a_i = A[i] res = -res inv = 1/a_i[i] for j in range(i+1, n): a_j = A[j] t = a_j[i] * inv for k in range(i+1, n): a_j[k] -= t * a_i[k] for i in range(n): res *= A[i][i] return res def mat_pri(A): for i in A: print(*i) def fractionize(A): for i in range(len(A)): for j in range(len(A[0])): A[i][j] = Fraction(A[i][j]) A = [[Fraction(c[i]>>j&1) for j in range(n)]for i in range(n)] D = determinant(A) C = dp[-1] print(int(C+D)//2,int(C-D)//2)