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:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

C = Counter(A)
C2 = Counter()
center = 0
for k, v in C.items():
    C2[v%4] += 1
    if (v % 4 == 1 or v % 4 == 3) and center != 0:
        print('NO')
        exit()
    if v % 4 == 1 or v % 4 == 3:
        center = k

grid = list2d(N, N, 0)
if N % 2 == 0:
    for k, v in C2.items():
        if k != 0 and v != 0:
            print('NO')
            exit()
    l = []
    for k, v in C.items():
        for _ in range(v//4):
            l.append(k)
    k = 0
    for i in range(N//2):
        for j in range(N//2):
            grid[i][j] = l[k]
            grid[N-1-i][N-1-j] = l[k]
            grid[i][N-1-j] = l[k]
            grid[N-1-i][j] = l[k]
            k += 1
    print('YES')
    for i in range(N):
        print(*grid[i])

else:
    for k, v in C2.items():
        if k == 2 and v > N-1:
            print('NO')
            exit()
    C[center] -= 1
    grid[N//2][N//2] = center
    l = []
    for k, v in C.items():
        if v % 4 == 2:
            l.append(k)
            C[k] -= 2
    k = 0
    for i in range(len(l)//2):
        grid[N//2][i] = l[k]
        grid[N//2][N-1-i] = l[k]
        k += 1
        grid[i][N//2] = l[k]
        grid[N-1-i][N//2] = l[k]
        k += 1
    l = []
    for k, v in C.items():
        if v % 4 == 0:
            for _ in range(v//4):
                l.append(k)
    k = 0
    for i in range(N//2):
        for j in range(ceil(N, 2)):
            if grid[i][j] == 0:
                grid[i][j] = l[k]
                grid[N-1-i][N-1-j] = l[k]
                grid[i][N-1-j] = l[k]
                grid[N-1-i][j] = l[k]
                k += 1
    for i in range(N//2):
        if grid[N//2][i] == 0:
            grid[N//2][i] = grid[i][N//2]
            grid[N//2][N-1-i] = grid[N-1-i][N//2]
    print('YES')
    for i in range(N):
        print(*grid[i])