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