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 os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
# sys.setrecursionlimit(100000)
# ^^^TAKE CARE FOR MEMORY LIMIT^^^
import random


def main():
    pass


BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


def binary(n):
    return (bin(n).replace("0b", ""))


def decimal(s):
    return (int(s, 2))


def pow2(n):
    p = 0
    while (n > 1):
        n //= 2
        p += 1
    return (p)


def primeFactors(n):
    l = []
    while n % 2 == 0:
        l.append(2)
        n = n / 2
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            l.append(i)
            n = n / i
    if n > 2:
        l.append(int(n))
    return (l)


def isPrime(n):
    if (n == 1):
        return (False)
    else:
        root = int(n ** 0.5)
        root += 1
        for i in range(2, root):
            if (n % i == 0):
                return (False)
        return (True)


def maxPrimeFactors(n):
    maxPrime = -1
    while n % 2 == 0:
        maxPrime = 2
        n >>= 1
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            maxPrime = i
            n = n / i
    if n > 2:
        maxPrime = n
    return int(maxPrime)


def countcon(s, i):
    c = 0
    ch = s[i]
    for i in range(i, len(s)):
        if (s[i] == ch):
            c += 1
        else:
            break
    return (c)


def lis(arr):
    n = len(arr)
    lis = [1] * n
    for i in range(1, n):
        for j in range(0, i):
            if arr[i] > arr[j] and lis[i] < lis[j] + 1:
                lis[i] = lis[j] + 1
    maximum = 0
    for i in range(n):
        maximum = max(maximum, lis[i])
    return maximum


def isSubSequence(str1, str2):
    m = len(str1)
    n = len(str2)
    j = 0
    i = 0
    while j < m and i < n:
        if str1[j] == str2[i]:
            j = j + 1
        i = i + 1
    return j == m


def maxfac(n):
    root = int(n ** 0.5)
    for i in range(2, root + 1):
        if (n % i == 0):
            return (n // i)
    return (n)


def p2(n):
    c = 0
    while (n % 2 == 0):
        n //= 2
        c += 1
    return c


def seive(n):
    primes = [True] * (n + 1)
    primes[1] = primes[0] = False
    i = 2
    while (i * i <= n):
        if (primes[i] == True):
            for j in range(i * i, n + 1, i):
                primes[j] = False
        i += 1
    pr = []
    for i in range(0, n + 1):
        if (primes[i]):
            pr.append(i)
    return pr


def ncr(n, r, p):
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % p
        den = (den * (i + 1)) % p
    return (num * pow(den,
                      p - 2, p)) % p


def denofactinverse(n, m):
    fac = 1
    for i in range(1, n + 1):
        fac = (fac * i) % m
    return (pow(fac, m - 2, m))


def numofact(n, m):
    fac = 1
    for i in range(1, n + 1):
        fac = (fac * i) % m
    return (fac)


def sod(n):
    s = 0
    while (n > 0):
        s += n % 10
        n //= 10
    return s

def getXor(n):
    xor=1
    for i in range(2,n+1):
        xor=xor^i
    return xor

n=int(input())
l=list(map(int,input().split()))
cnt=[0]*(max(l)+1)
for i in l:
    cnt[i]+=1
#print(*cnt)
if(n%2==0):
    f=True
    for i in cnt:
        if(i%4):
            f=False
            break
    if(f):
        print("YES")
        ele=[]
        for i in range(0,len(cnt)):
            ele+=[i]*(cnt[i]//4)
        #print(ele)
        mat=[]
        ptr=0
        for i in range(0,n//2):
            cl=[]
            for j in range(0,n//2):
                cl.append(ele[ptr])
                ptr+=1
            mat.append(cl)
        #print(mat)
        for i in range(0,n//2):
            mat[i]+=mat[i][::-1]
        #print(mat)
        for i in range(0,n//2):
            mat.append(mat[n//2-1-i])
        #print(mat)
        for i in mat:
            print(*i)
    else:
        print("NO")
else:
    odd=[]
    for i in range(0,len(cnt)):
        if(cnt[i]%2):
            odd.append(i)
    if(len(odd)!=1):
        print("NO")
    else:
        #print(odd)
        cnt[odd[0]]-=1
        ele=[]
        mid=[]
        for i in range(0, len(cnt)):
            ele += [i] * (cnt[i] // 4)
            cnt[i]%=4
            mid+=[i] * (cnt[i] // 2)
        #print(ele,mid)
        if(len(ele)<((n//2)*(n//2))):
            print("NO")
        else:
            for i in range(((n//2)*(n//2)),len(ele)):
                mid+=[ele[i]]*2
            ele=ele[:((n//2)*(n//2))]
            #print(ele,mid)
            mat = [[] for i in range(0,n//2)]
            ptr = 0
            for i in range(0, n // 2):
                #cl = []
                for j in range(0, n // 2):
                    #cl.append(ele[ptr])
                    mat[i].append(ele[ptr])
                    ptr += 1
                #mat.append(cl)
            #print(mat)
            mr=mid[:len(mid)//2]
            mc=mid[len(mid)//2:]
            #print(mr,mc)
            #mat.append(mr+odd+mr[::-1])
            #print(mat)
            for i in range(0,n//2):
                mat[i]+=mat[i][::-1].copy()
            #print(mat)
            for i in range(0, n // 2):
                mat.append(mat[n // 2 - 1 - i].copy())
            #print(mat)
            mat.insert(n//2,mr+odd+mr[::-1])
            #print(mat)
            #print(mc)
            #mat[0].append("HEU")
            for i in range(0,n//2):
                #mat[i].append("HEU")
                colval=mc[i]
                #print(mat[i],mat[n-1-i],colval)
                mat[i].insert(n//2,colval)
                mat[n-1-i].insert(n//2,colval)
            print("YES")
            for i in mat:
                print(*i)
'''
6
1 2 3 3 2 1 1 2 3 3 2 1 1 2 3 3 2 1 1 2 3 3 2 1 1 2 3 3 2 1 1 2 3 3 2 1
'''