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:
from sys import stdin,stdout
import operator
def main():
    n=int(stdin.readline())
    arr=[int(k) for k in stdin.readline().split()]
    freq=[0]*1001
    for i in range(n*n):
        freq[arr[i]]+=1
    matrix=[]
    #print(freq)
    counter=0
    for i in range(n):
        lis=[]
        for j in range(n):
            lis.append(0)
        matrix.append(lis)
    for i in range((n+1)//2):
        for j in range((n+1)//2):
            b1=(i,j)
            b2=(i,n-j-1)
            b3=(n-i-1,j)
            b4=(n-i-1,n-j-1)
            if b1[1]==b2[1] and b1[0]==b3[0]:
                for k in range(1,1001):
                    if freq[k]==1:
                        matrix[i][j]=k
                        break
            elif b1[1]==b2[1] and b1[0]!=b3[0]:
                mx=0
                ind=-1
                filled=0
                for k in range(1,1001):
                    if freq[k]==2:
                        matrix[i][j]=k
                        matrix[n-i-1][j]=k
                        freq[k]-=2
                        filled=1
                        break
                    if freq[k]>mx:
                        mx=freq[k]
                        ind=k
                if filled==0:
                    if mx>2:
                        matrix[i][j]=ind
                        matrix[n-i-1][j]=ind
                        freq[ind]-=2
                    else:
                        counter=1
                        break



            elif b1[0]==b3[0] and b1[1]!=b2[1]:
                mx = 0
                filled=0
                ind = -1
                for k in range(1,1001):
                    if freq[k] == 2:
                        matrix[i][j] = k
                        matrix[i][n-j-1] = k
                        freq[k] -= 2
                        filled=1
                        break
                    if freq[k] > mx:
                        mx = freq[k]
                        ind = k
                if filled==0:
                    if mx >= 2:
                        matrix[i][j] = ind
                        matrix[i][n-j-1] = ind
                        freq[ind] -= 2
                    else:
                        counter = 1
                        break
            else:
                filled=0
                for k in range(1,1001):
                    if freq[k]>=4:
                        el=k
                        matrix[i][j]=el
                        matrix[i][n-j-1]=el
                        matrix[n-i-1][j]=el
                        matrix[n-i-1][n-j-1]=el
                        freq[k]-=4
                        filled=1
                        break
                if filled==0:
                    counter=1
                    break
            if counter==1:
                break
        if counter==1:
            break
    #print(freq)
    if counter==1:
        print("No")
    else:
        print("Yes")
        for i in range(n):
            for j in range(n):
                print(matrix[i][j],end=" ")
            print()
if __name__=="__main__":
    main()