n = int(input()) ABC = [list(map(int,input().split())) for i in range(n)] dp = [[[0]*3 for i in range(n)] for j in range(1<> t & 1: continue if k == 0: x,y = a,b elif k == 1: x,y = a,c else: x,y = b,c na,nb,nc = ABC[t] if (na <= x and nb <= y) or (na <= y and nb <= x): dp[bit|1<