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 PYTHON):

Solution:
#!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>

"""
from __future__ import division, print_function

import itertools
import os
import sys
from atexit import register
from collections import Counter
from io import BytesIO


class dict(dict):
    """dict() -> new empty dictionary"""

    def items(self):
        """D.items() -> a set-like object providing a view on D's items"""
        return dict.iteritems(self)

    def keys(self):
        """D.keys() -> a set-like object providing a view on D's keys"""
        return dict.iterkeys(self)

    def values(self):
        """D.values() -> an object providing a view on D's values"""
        return dict.itervalues(self)


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


range = xrange

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))

input = lambda: sys.stdin.readline().rstrip('\r\n')


def main():
    n = int(input())
    a = list(map(int, input().split()))

    mat = [[0] * n for _ in range(n)]

    if n % 2 == 0:
        _a = Counter(a)
        for ai in _a.values():
            if ai % 4 != 0:
                print('NO')
                return

        row, col = 0, 0
        for ai in _a:
            while _a[ai] != 0:
                mat[row][col] = ai
                mat[row][n - col - 1] = ai
                mat[n - row - 1][col] = ai
                mat[n - row - 1][n - col - 1] = ai
                _a[ai] -= 4
                col += 1
                if col == n // 2:
                    col = 0
                    row += 1

        b = Counter()
        for row in mat:
            b += Counter(row)

        if b != Counter(a):
            print('NO')
            return

        print('YES')
        for row in mat:
            print(*row)

    else:
        _a = Counter(map(lambda x: x % 4, Counter(a).values()))

        if {_a[1], _a[3]} != {0, 1}:
            print('NO')
            return

        __a = Counter(a)
        for ai in __a:
            if __a[ai] % 4 == 1:
                mat[n // 2][n // 2] = ai
                __a[ai] -= 1
            if __a[ai] % 4 == 3:
                mat[n // 2][n // 2] = ai
                __a[ai] -= 1

        row, col = 0, 0
        column_full = False
        row_full = False
        i = 1
        for ai in __a:
            if __a[ai] % 4 == 2:
                if not column_full:
                    mat[n // 2 - i][n // 2] = ai
                    mat[n // 2 + i][n // 2] = ai
                    i += 1
                    if i - 1 == n // 2:
                        i = 1
                        column_full = True
                elif not row_full:
                    mat[n // 2][n // 2 + i] = ai
                    mat[n // 2][n // 2 - i] = ai
                    i += 1
                    if i - 1 == n // 2:
                        row_full = True
                __a[ai] -= 2

        for ai in __a:
            while __a[ai] > 0:
                if not column_full:
                    mat[n // 2 - i][n // 2] = ai
                    mat[n // 2 + i][n // 2] = ai
                    i += 1
                    if i - 1 == n // 2:
                        i = 1
                        column_full = True
                    __a[ai] -= 2
                elif not row_full:
                    mat[n // 2][n // 2 + i] = ai
                    mat[n // 2][n // 2 - i] = ai
                    i += 1
                    if i - 1 == n // 2:
                        row_full = True
                    __a[ai] -= 2
                else:
                    mat[row][col] = ai
                    mat[row][n - col - 1] = ai
                    mat[n - row - 1][col] = ai
                    mat[n - row - 1][n - col - 1] = ai
                    __a[ai] -= 4
                    col += 1
                    if col == n // 2:
                        col = 0
                        row += 1

        b = Counter()
        for row in mat:
            b += Counter(row)

        if b != Counter(a):
            print('NO')
            return

        print('YES')
        for row in mat:
            print(*row)


if __name__ == '__main__':
    main()