import sys from collections import deque, Counter sys.setrecursionlimit(5 * 10 ** 5) from pypyjit import set_param set_param('max_unroll_recursion=-1') input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 n = ii() def solve(n): if n == 1: return [-1] if n == 2: return [[7, 14, 0, 8],[4, 12, 2, 11],[15, 9, 6, 1], [13, 10, 5, 3]] else: X = solve(n - 1) Y = [[0] * (1 << (n - 1)) for _ in range(1 << (n - 1))] for i in range(1<<(n - 1)): for j in range(1 << (n - 1)): Y[i][j] = i * (1<<(n - 1)) + j ans = [[0] * (1<