n = int(input()) if n == 1: print('No') exit() n2 = 1 << n a = [[0] * n2 for _ in range(n2)] d = [ [0, -1, 1, 0], [1, 0, 0, -1], [-1, 0, 0, 1], [0, 1, -1, 0] ] for i in range(0, n2, 2): for j in range(0, n2, 2): ri = i.bit_count() % 2 rj = j.bit_count() % 2 for x in range(2): for y in range(2): a[i+x][j+y] = d[2*ri+x][2*rj+y] 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() % 2 == int(a[i][j] != 0) print('Yes') for ai in a: print(*ai)