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:
""" 
Author: Raj Singh
Date:   21.02.19
"""
from sys import stdin,stdout
#import math#import heapq#import operator
#from collections import OrderedDict,Counter,defaultdict
def getKey(item):
    return item[1]#l=sorted(l, key=getKey,reverse=True) 
#a = [[0 for x in range(n)] for y in range(n)]

def inp():
    return stdin.readline()
def minp():
    return map(int,stdin.readline().rstrip().split())
def linp():
    return list(minp())
def main():
    n=int(inp())
    l=linp()
    ll=list(set(l))
    cnt=0
    a = [[0 for x in range(n)] for y in range(n)]
    #print(a)
    if n==1:
        print('YES')
        print(*l)
        exit()
    if n%2==0:
        if len(ll)<=int(n/2)*int(n/2):
            num=[]
            for i in ll:
                c=l.count(i)
                if c%4==0:
                    x=int(c/4)
                    cnt+=x
                    for j in range(x):
                        num.append(i)
                else:
                    print('NO')
                    exit()
            if cnt==int(n/2)*int(n/2):
                print('YES')
                pos=0
                #print(num)
                for j in range(int(n/2)):
                    for k in range(int(n/2)):
                        #print(j,k)
                        #print(num[pos])
                        a[j][k]=num[pos]
                        a[j][n-k-1]=num[pos]
                        a[n-j-1][k]=num[pos]
                        a[n-j-1][n-k-1]=num[pos]
                        pos+=1
                for j in range(n):
                    print(*a[j])
            else:
                print('NO')
                exit()
        else:
            print('NO')
            exit()
                                                
    else:
        num=[]
        ex=[]
        f=0
        d=[]
        f=0
        for i in ll:
            d.append([i,l.count(i)])
        
        d=sorted(d, key=getKey,reverse=True)  
        #print(d)
        for i in range(len(ll)):
            c=int(d[i][1]/4)
            d[i][1]-=c*4
            cnt+=c
            for j in range(c):
                num.append(d[i][0])
            if cnt>=int(n/2)*int(n/2):
                d[i][1]+=(cnt-int(n/2)*int(n/2))*4
                f=1
                break
        if f==0:
            print('NO')
            exit()
        
        pos=0
        
        for j in range(int(n/2)):
            for k in range(int(n/2)):
                #print(j,k)
                #print(num[pos])
                a[j][k]=num[pos]
                a[j][n-k-1]=num[pos]
                a[n-j-1][k]=num[pos]
                a[n-j-1][n-k-1]=num[pos]
                pos+=1
        
        f=0
        pos=0
        p=0
        #print(d)
        while(p<int(n/2)):
            if d[pos][1]%2==0:
                c=int(d[pos][1]/2)
                for j in range(c):
                    a[int(n/2)][p]=d[pos][0]
                    a[int(n/2)][n-p-1]=d[pos][0]
                    d[pos][1]-=2
                    #print(d)
                    #print(a)
                    p+=1
                    if p>=int(n/2):
                        break
                   
                pos+=1
            else:
                if f==0:
                    f=1
                    c=int(d[pos][1]/2)
                    for j in range(c):
                        a[int(n/2)][p]=d[pos][0]
                        a[int(n/2)][n-p-1]=d[pos][0]
                        d[pos][1]-=2
                        #print(d)
                        
                        p+=1
                        if p>=int(n/2):
                            break
                    a[int(n/2)][int(n/2)]=d[pos][0]
                    #print(d[pos][0])
                    d[pos][1]-=1
                    #pos+=1
                else:
                    print('NO')
                    exit()
        p=0
        #for j in range(n):
        #    print(*a[j])
        #print(d) 
        pos=0
        while(p<int(n/2)):
            if d[pos][1]%2==0:
                c=int(d[pos][1]/2)
                for j in range(c):
                    a[p][int(n/2)]=d[pos][0]
                    a[n-p-1][int(n/2)]=d[pos][0]
                    d[pos][1]-=2
                    p+=1
                    if p>=int(n/2):
                        break
                pos+=1
            else:
                d[pos][1]
                if f==0:
                    f=1
                    c=int(d[pos][1]/2)
                    for j in range(c):
                        a[p][int(n/2)]=d[pos][0]
                        a[n-p-1][int(n/2)]=d[pos][0]
                        p+=1
                        d[pos][1]-=2
                        if p>=int(n/2):
                            break
                    a[int(n/2)][int(n/2)]=d[pos][0]
                    d[pos][1]-=1
                else:
                    #print(d)
                    print('NO')
                    exit()
        
        if a[int(n/2)][int(n/2)]==0:
           a[int(n/2)][int(n/2)]=d[-1][0] 
        
        print('YES')
        for j in range(n):
            print(*a[j])
        
if __name__=="__main__":
    main()