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:
n=int(input())
s=[int(x) for x in input().split()]
L=sorted(s)
flag=0
if(n%2!=0):
    l4=[]
    l2=[]
    l1=[]
    G=[]
    p=1
    for i in range(1,len(L)):
        if(L[i]!=L[i-1]):
            G.append([L[i-1],p])
            p=1
        else:
            p=p+1
    G.append([L[-1],p])
    #print(G)
    for i in range(0,len(G)):
        if(G[i][1]>=4):
            l4=l4+[G[i][0]]*(4*(G[i][1]//4))
            G[i][1]=G[i][1]%4
            l2=l2+[G[i][0]]*(2*(G[i][1]//2))
            G[i][1]=G[i][1]%2
            l1=l1+[G[i][0]]*G[i][1]
        elif(G[i][1]>=2):
            l2=l2+[G[i][0]]*(2*(G[i][1]//2))
            G[i][1]=G[i][1]%2
            l1=l1+[G[i][0]]*G[i][1]
        else:
            l1=l1+[G[i][0]]*G[i][1]
        #print(l4,l2,l1)
    n1=4*(((n-1)//2)**2)
    n2=2*(n-1)
    if(len(l4)>n1):
        l2=l2+l4[n1:]
        l4=l4[:n1]
        #print(n1,l4)
    if(len(l2)>n2):
        l1=l1+l2[n2:]
        l2=l2[:n2]
    if(len(l4)==n1 and len(l2)==n2 and len(l1)==1):
        flag=1
    #print(l4,l2,l1)
    if(flag!=0):
        L1=[]
        k=(n-1)//2
        pt1=0
        pt2=0
        for i in range(0,k):
            for j in range(0,k):
                for m in range(4):
                    L1.append(l4[pt1])
                    pt1=pt1+1
            for j in range(2):
                L1.append(l2[pt2])
                pt2=pt2+1
        for i in range(n-1):
            L1.append(l2[pt2])
            pt2=pt2+1
        L1=L1+l1
        L=L1

else:
    I=0
    for i in range(0,len(L),4):
        W=L[i:4*(I+1)]
        I=I+1
        #print(W)
        if(len(list(set(W)))==1):
            flag=2
        else:
            flag=0
            break
            
if(flag==0):
    print('NO')
else:
    print('YES')
    
    dp=[]
    for i in range(0,n):
        h=[]
        for j in range(0,n):
            h.append(0)
        dp.append(h)
    ptr1=[0,0]
    ptr3=[n-1,n-1]
    ptr2=[n-1,0]
    ptr4=[0,n-1]
    if(n%2!=0):
        c=1
        r=-1
        for i in range(0,len(L),2):
            r=r+1
            if(ptr1==ptr2 and ptr3==ptr4 and ptr1!=ptr3):
                dp[ptr1[0]][ptr1[1]]=L[i]
                dp[ptr3[0]][ptr3[1]]=L[i+1]
                ptr1=[0,c]
                ptr3=[n-1,n-c-1]
                ptr2=[n-1,c]
                ptr4=[0,n-c-1]
                c=c+1
                r=0
            elif(ptr1==ptr4 and ptr2==ptr3 and ptr1!=ptr2):
                dp[ptr1[0]][ptr1[1]]=L[i]
                dp[ptr2[0]][ptr2[1]]=L[i+1]
                ptr1=[ptr1[0]+1,ptr1[1]]
                ptr2=[ptr2[0]-1,ptr2[1]]
                ptr3=[ptr3[0]-1,ptr3[1]]
                ptr4=[ptr4[0]+1,ptr4[1]]
            elif(ptr1==ptr3 and ptr2==ptr4 and ptr1==ptr4):
                dp[ptr1[0]][ptr1[1]]=L[i]
                #dp[ptr3[0]][ptr3[1]]=L[i+1]
            else:
                if(r%2==0):
                    dp[ptr1[0]][ptr1[1]]=L[i]
                    dp[ptr2[0]][ptr2[1]]=L[i+1]
                    ptr1=[ptr1[0]+1,ptr1[1]]
                    ptr2=[ptr2[0]-1,ptr2[1]]
                else:
                    dp[ptr3[0]][ptr3[1]]=L[i]
                    dp[ptr4[0]][ptr4[1]]=L[i+1]
                    ptr3=[ptr3[0]-1,ptr3[1]]
                    ptr4=[ptr4[0]+1,ptr4[1]]
            #print(dp)
                
    else:
        c=1
        for i in range(0,len(L),4):
            dp[ptr1[0]][ptr1[1]]=L[i]
            dp[ptr2[0]][ptr2[1]]=L[i+1]
            dp[ptr3[0]][ptr3[1]]=L[i+2]
            dp[ptr4[0]][ptr4[1]]=L[i+3]
            ptr1=[ptr1[0]+1,ptr1[1]]
            ptr2=[ptr2[0]-1,ptr2[1]]
            ptr3=[ptr3[0]-1,ptr3[1]]
            ptr4=[ptr4[0]+1,ptr4[1]]
            if(ptr1[0]>ptr2[0]):
                ptr1=[0,c]
                ptr3=[n-1,n-c-1]
                ptr2=[n-1,c]
                ptr4=[0,n-c-1]
                c=c+1
            #print(dp)


    for i in range(0,n):
        for j in range(0,n):
            print(dp[i][j],end=" ")
        print(" ")