n = int(input()) if n == 1: print('No') exit() n2 = 1 << n a = [[0] * n2 for _ in range(n2)] d2 = [ [0, -1, 1, 0], [1, 0, 0, -1], [-1, 0, 0, 1], [0, 1, -1, 0] ] d3 = [ [0,1,1,0,-2,0,0,0], [-1,0,0,-1,0,2,0,0], [-1,0,0,2,0,0,-1,0], [0,1,-2,0,0,0,0,1], [2,0,0,0,0,-1,-1,0], [0,-2,0,0,1,0,0,1], [0,0,1,0,1,0,0,-2], [0,0,0,-1,0,-1,2,0] ] for i in range(n2): for j in range(n2): if (i ^ j).bit_count() == 1: k = (i ^ j).bit_length() - 1 if n % 2 == 1 and k >= n - 3: bi = i >> n - 3 bj = j >> n - 3 a[i][j] = d3[bi][bj] a[j][i] = -a[i][j] else: k &= ~1 bi = i >> k & 3 bj = j >> k & 3 a[i][j] = d2[bi][bj] a[j][i] = -a[i][j] for i in range(n2): assert sum(a[i]) == 0 for j in range(n2): assert a[i][j] == -a[j][i] assert ((i ^ j).bit_count() == 1) == (a[i][j] != 0) print('Yes') for ai in a: print(*ai)