MOD = 10 ** 9 + 7 INF = 10 ** 13 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) def main(): N = int(input()) cube = [list(map(int,input().split())) for _ in range(N)] L = (1<>i)&1: flag.append(i) else: non_flag.append(i) for i in flag: for j in non_flag: for k in range(3): for l in range(3): if ((cube[i][k] >= cube[j][l] and cube[i][(k + 1)%3] >= cube[j][(l + 1)%3]) or (cube[i][(k + 1)%3] >= cube[j][l] and cube[i][k] >= cube[j][(l + 1)%3])): dp[s^(1<