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:
import math
import bisect
import itertools
import sys
I=lambda : sys.stdin.readline()
mod=10**9 +7
'''fact=[1]*100001
ifact=[1]*100001
for i in range(1,100001):
    fact[i]=((fact[i-1])*i)%mod
    ifact[i]=((ifact[i-1])*pow(i,mod-2,mod))%mod
def ncr(n,r):
    return (((fact[n]*ifact[n-r])%mod)*ifact[r])%mod
def npr(n,r):
    return (((fact[n]*ifact[n-r])%mod))
    '''

def modu(a,m):
    if a%m:
        return a%m
    return m

def mindiff(a):
    b=a[:]
    b.sort()
    m=10000000000
    for i in range(len(b)-1):
        if b[i+1]-b[i]<m:
            m=b[i+1]-b[i]
    return m
    
def lcm(a,b):
    return a*b//math.gcd(a,b)

    
def merge(a,b):
    i=0;j=0
    c=0
    ans=[]
    while i<len(a) and j<len(b):
        if a[i]<b[j]:
            ans.append(a[i])
            i+=1
        else:
            ans.append(b[j])
            c+=len(a)-i
            j+=1
    ans+=a[i:]
    ans+=b[j:]
    return ans,c
def mergesort(a):
    if len(a)==1:
        return a,0
    mid=len(a)//2   
    left,left_inversion=mergesort(a[:mid])
    right,right_inversion=mergesort(a[mid:])
    m,c=merge(left,right)
    c+=(left_inversion+right_inversion)
    return m,c
    
def is_prime(num):
    if num == 1: return False
    if num == 2: return True
    if num == 3: return True
    if num%2 == 0: return False
    if num%3 == 0: return False
    t = 5
    a = 2
    while t <= int(math.sqrt(num)):
        if num%t == 0: return False
        t += a
        a = 6 - a
    return True
    
  
def ceil(a,b):
    if a%b==0:
        return a//b
    else:
        return (a//b + 1)

def binsearch(arr,b,low,high):
    if low==high:
        return low
    if arr[math.ceil((low+high)/2)]<b:
        return binsearch(arr,b,low,math.ceil((low+high)/2) -1 )
    else:
        return binsearch(arr,b,math.ceil((low+high)/2),high)
def ncr1(n,r):
    s=1
    for i in range(min(n-r,r)):
        s*=(n-i)
        s%=mod
        s*=pow(i+1,mod-2,mod)
        s%=mod
    return s
    
def calc(n,m,r):
    s=0
    for i in range(0,r+1,2):
        s+=ncr1(n,i)*ncr1(m,i)
        s%=mod
    return s    
        
        

#/////////////////////////////////////////////////////////////////////////////////////////////////

n=int(input())
d={}
a=list(map(int,input().split()))
b=[]
a.sort()
c=[]
p=a[0]
#print(a)
for i in a:
    if i==p and len(c)!=4:
        c.append(i)
    elif i!=p or len(c)==4:
        b.append([len(c)]+c)
        c=[i]
        p=i
b.append([len(c)] + c)        
b.sort(reverse=True)
#print(b)
kk=[]
ans=[[0 for i in range(n+1)] for j in range(n+1)]

def printarr(ans):
    for i in range(1,len(ans)):
        print(*ans[i][1:])
d={}    
for i in b:
    if i[0]==3:
        d[i[0] - 1]=d.get(i[0] - 1,0)+1
        #d[1]=1
    else:
        d[i[0]]=d.get(i[0],0)+1
    if i[0]==3:
        kk+=i[1:3]
        p=i[3]
    else:
        kk+=i[1:]
try:
    kk+=[p]
except:
    p=1
#print(d)
#print(kk)
if n%2==0:
    k=0
    f=0
    if d.get(4,0)<(n//2)**2:
        print("NO")
    else:
        for i in range(1,n//2 + 1):
            for j in range(1,n//2 + 1):
                if True:
                    ans[i][j]=kk[k];k+=1
                    ans[n+1-i][j]=kk[k];k+=1
                    ans[i][n-j+1]=kk[k];k+=1
                    ans[n-i+1][n-j+1]=kk[k];k+=1
        print("YES")
        printarr(ans)            
        
else:
    if d.get(4,0)<(n//2)**2 or ((d.get(4,0) - (n//2)**2 )*2 + d.get(2,0))<(n//2)*2:
        print("NO")
    else:
        k=0
        for i in range(1,n//2 + 1):
            for j in range(1,n//2 + 1):
                ans[i][j]=kk[k];k+=1
                ans[n+1-i][j]=kk[k];k+=1
                ans[i][n-j+1]=kk[k];k+=1
                ans[n-i+1][n-j+1]=kk[k];k+=1
        for i in range(1,n//2 + 1):
            ans[i][math.ceil(n/2)]=kk[k];k+=1
            ans[n-i+1][math.ceil(n/2)]=kk[k];k+=1
        #printarr(ans)
        for j in range(1,n//2 + 1):
            ans[math.ceil(n/2)][j]=kk[k];k+=1
            ans[math.ceil(n/2)][n-j+1]=kk[k];k+=1
        ans[math.ceil(n/2)][math.ceil(n/2)]=kk[k]
        print("YES")
        printarr(ans) 
#print(ans)        
    
#print(kk)