n = int(input()) size = 1 << n # Check if N is odd if n % 2 == 1: print(-1) else: # Generate the matrix based on even N (example for N=2) # Precomputed example for N=2 if n == 2: matrix = [ [7, 14, 0, 8], [4, 12, 2, 11], [15, 9, 6, 1], [13, 10, 5, 3] ] for row in matrix: print(' '.join(map(str, row))) else: # General case for even N (not implemented here due to complexity) print(-1)