import sys

sys.setrecursionlimit(10**5)


def popcount(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)
    c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)
    c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)
    c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)
    return c


def solve(n):
    if n == 1:
        return []
    if n % 2 == 0:
        edge = [[0] * (1 << n) for i in range(1 << n)]
        for v in range(1 << n):
            for i in range(n):
                u = v ^ (1 << i)
                edge[u][v] = 1
        trail = []

        def dfs(v):
            for u in range(1 << n):
                if edge[v][u] > 0:
                    edge[v][u] -= 1
                    edge[u][v] -= 1
                    dfs(u)
            trail.append(v)

        dfs(0)
        A = [[0] * (1 << n) for i in range(1 << n)]
        for i in range(len(trail) - 1):
            u, v = trail[i], trail[i + 1]
            A[u][v] = 1
            A[v][u] = -1
        return A
    B = solve(n - 1)
    A = [[0] * (1 << n) for i in range(1 << n)]
    m = 1 << (n - 1)
    for i in range(m):
        for j in range(m):
            A[i][j] = B[i][j]
            A[i | m][j | m] = -B[i][j]

    for i in range(0, m, 2):
        p = [i, i + 1, (i + 1) | m, i | m, i]
        t = B[i][i + 1]
        for j in range(4):
            u = p[j]
            v = p[j + 1]
            A[u][v] += t
            A[v][u] -= t
    return A


n = int(input())
if n == 1:
    print("No")
    exit()

A = solve(n)
print("yes")
for i in A:
    print(*i)