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:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, sin, cos, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def euclidean_distance(y1, x1, y2, x2):
    return sqrt((y1 - y2) ** 2 + (x1 - x2) ** 2)


def manhattan_distance(y1, x1, y2, x2):
    return abs(y1 - y2) + abs(x1 - x2)


def main():
    N = int(input())
    D = list(map(int, input().split()))

    f, t, o = [], [], []
    C = Counter(D)
    for k, v in C.items():
        while v >= 4:
            v -= 4
            f.append(k)
        while v >= 2:
            v -= 2
            t.append(k)
        if v:
            o.append(k)

    ans = [[0] * N for _ in range(N)]
    if N % 2 == 0:
        if len(t) > 0 or len(o) > 0:
            print(NO)
            return

        i = 0
        for y in range(N // 2):
            for x in range(N // 2):
                ans[y][x] = ans[-y - 1][x] = ans[y][-x - 1] = ans[-y - 1][-x - 1] = f[i]
                i += 1

    else:
        if len(f) < ((N // 2) * (N // 2)) or len(o) != 1:
            print(NO)
            return

        i = 0
        for y in range(N // 2):
            for x in range(N // 2):
                ans[y][x] = ans[-y - 1][x] = ans[y][-x - 1] = ans[-y - 1][-x - 1] = f[i]
                i += 1

        while i < len(f):
            t.append(f[i])
            t.append(f[i])
            i += 1

        i = 0
        for k in range(N // 2):
            ans[N // 2][k] = ans[N // 2][-k - 1] = t[i]
            i += 1

        for k in range(N // 2):
            ans[k][N // 2] = ans[-k - 1][N // 2] = t[i]
            i += 1

        ans[N // 2][N // 2] = o[0]

    print(YES)
    for line in ans:
        print(*line, sep=" ")


if __name__ == '__main__':
    main()