Problem: Let's call some square matrix with integer values in its cells palindromic if it doesn't change after the order of rows is reversed and it doesn't change after the order of columns is reversed.

For example, the following matrices are palindromic:

<image>

The following matrices are not palindromic because they change after the order of rows is reversed:

<image>

The following matrices are not palindromic because they change after the order of columns is reversed:

<image>

You are given n^2 integers. Put them into a matrix of n rows and n columns so that each number is used exactly once, each cell contains exactly one number and the resulting matrix is palindromic. If there are multiple answers, print any. If there is no solution, print "NO".

Input

The first line contains one integer n (1 ≤ n ≤ 20).

The second line contains n^2 integers a_1, a_2, ..., a_{n^2} (1 ≤ a_i ≤ 1000) — the numbers to put into a matrix of n rows and n columns.

Output

If it is possible to put all of the n^2 numbers into a matrix of n rows and n columns so that each number is used exactly once, each cell contains exactly one number and the resulting matrix is palindromic, then print "YES". Then print n lines with n space-separated numbers — the resulting matrix.

If it's impossible to construct any matrix, then print "NO".

You can print each letter in any case (upper or lower). For example, "YeS", "no" and "yES" are all acceptable.

Examples

Input


4
1 8 8 1 2 2 2 2 2 2 2 2 1 8 8 1


Output


YES
1 2 2 1
8 2 2 8
8 2 2 8
1 2 2 1


Input


3
1 1 1 1 1 3 3 3 3


Output


YES
1 3 1
3 1 3
1 3 1


Input


4
1 2 1 9 8 4 3 8 8 3 4 8 9 2 1 1


Output


NO


Input


1
10


Output


YES
10 

Note

Note that there exist multiple answers for the first two examples.

Solution (in PYTHON3):

Solution:
def print_mat(m):
    n = len(m)
    for i in range(n):
        print(' '.join([str(j) for j in m[i]]))

def mat_unity4(b):
    global n
    b1, b2, b3, b4 = b, tr_mat(b, 2), tr_mat(b, 3), tr_mat(b, 4)
    r = [['' for i in range(n)] for j in range(n)]
    for i in range(n // 2):
        for j in range(n):
            if j < n // 2:
                r[i][j] = b1[i][j]
            else:
                r[i][j] = b2[i][j % (n // 2)]
    for i in range(n // 2):
        for j in range(n):
            if j < n // 2:
                r[i + n // 2][j] = b4[i][j]
            else:
                r[i + n // 2][j] = b3[i][j % (n // 2)]
    return r

def mat_unity9(b, m, c):
    global n
    b1, b2, b3, b4 = b, tr_mat(b, 2), tr_mat(b, 3), tr_mat(b, 4)
    b5, b6, b7, b8 = m[0], m[1], m[0][::-1], m[1][::-1]
    b9 = c
    r = [['' for i in range(n)] for j in range(n)]
    for i in range(n // 2):
        for j in range(n):
            if j < n // 2:
                r[i][j] = b1[i][j]
            elif j == n // 2:
                r[i][j] = b5[i]
            else:
                r[i][j] = b2[i][j % (n // 2 + 1)]
    for j in range(n):
        if j < n // 2:
            r[n // 2][j] = b8[j]
        elif j == n // 2:
            r[n // 2][j] = b9
        else:
            r[n // 2][j] = b6[j % (n // 2 + 1)]
    for i in range(n // 2):
        for j in range(n):
            if j < n // 2:
                r[i + n // 2 + 1][j] = b4[i][j]
            elif j == n // 2:
                r[i + n // 2 + 1][j] = b7[i]
            else:
                r[i + n // 2 + 1][j] = b3[i][j % (n // 2 + 1)]
    return r

def tr_mat(m, t):
    n = len(m)
    if n == 1:
        return m
    r = [['' for i in range(n)] for j in range(n)]
    if t == 2:
        for i in range(n):
            for j in range(n):
                r[i][j] = m[i][n - j - 1]
    elif t == 4:
        for j in range(n):
            for i in range(n):
                r[i][j] = m[n - i - 1][j]
    else:
        r = tr_mat(tr_mat(m, 2), 4)
    return r

def test(m):
    for i in range(2, 5):
        if m != tr_mat(m, i):
            return False
    return True

from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
d = Counter(a)

if n % 2 == 0:
    i = 0
    c = list(d.keys())
    while i < len(d) and d[c[i]] % 4 == 0:
        i += 1
    else:
        if i < len(d):
            print('NO')
        else:
            print('YES')
            b = [['' for i in range(n // 2)] for j in range(n // 2)]
            sc = 0
            for i in c:
                d[i] //= 4
                for j in range(d[i]):
                    b[sc // (n // 2)][sc % (n // 2)] = i
                    sc += 1
            print_mat(mat_unity4(b))
            #print(test(mat_unity4(b)))
            
else:
    c = list(d.keys())
    k1, k2, k4 = [], [], []
    b = 0
    for i in range(len(c)):
        it = d[c[i]]
        if it % 4 == 1:
            k1.append(c[i])
        elif it % 4 == 2:
            k2.append(c[i])
        elif it % 4 == 3:
            k2.append(c[i])
            k1.append(c[i])
        for j in range(it // 4):
            k4.append(c[i])
    
    s = len(k4) - (n // 2) ** 2
    for i in range(s):
        k2.append(k4[0])
        k2.append(k4[0])
        del k4[0]

    if len(k1) != 1 or len(k2) != 2 * (n // 2) or len(k4) != (n // 2) ** 2:
        print('NO')
    else:
        print('YES')
        b1 = [['' for i in range(n // 2)] for j in range(n // 2)]
        b2 = [['' for i in range(n // 2)] for j in range(2)]
        b3 = k1[0]
        sc = 0
        for i in k4:
            b1[sc // (n // 2)][sc % (n // 2)] = i
            sc += 1
        sc = 0
        for i in k2:
            b2[sc // (n // 2)][sc % (n // 2)] = i
            sc += 1
        print_mat(mat_unity9(b1, b2, b3))
        #print(test(mat_unity9(b1, b2, b3)))