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:
"""
XXXXXXXXXKKKK0000KXNWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNNXK0OO00Okxxxxdxxxxxxkkkkdddoccloodxxxxxkxxxdddolccc,,:ccllclccdddxdxxxkkOO00kkO00XXKKNXKKKXXOkOOkkkOOO0XKK0O0KKKK0KKXXXXXXNWWWWWWWWWNNXXKKXXXNNWMMMMMMMMMMMMMMMMMMMMMMMWWWNNWWWWWWNNNNXXXK0Okxddddddollccc::::::::;;,,''',,,,,,
XXXXXXXXXXXXXXXXNNWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXK0OkkOOOkkkkxxxxddoooodxxxddooolodxkxxxxxxxxdolllc:;,:cccccc:;ldoododxkOOOOOkk0KO0K0XX0O0KX0kkkxO00kkOXXK0KK000KKKKKXXNNXNWWWNNNWNNNK0000KXXNWWMWWWWWWMMMMMMMMMMMMMMMMMWWWWWMMWWWWNNNXXXK00OO0OOOkkdolllccc:;;,,,,,,,''''''''''
NNNNNNXXNNNNNWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXXK0OOkkkkkkkkkkkkkxxddolllodxxddddddooxkxxddddddlcll;,;:ccc::::;;::cclodxkOOOOkxxO0O0OOKKOOK0K0kxkOOOOOOKNK0KKKKKXNNXXXXXXNNNNNNNXKKKOOkkO0KKKXXXNNWNNWWWWWWWWMMMMMMMMMMMMMMMMMWWWWWWWWNNNXXXXXXXXK0OOkkdollc::;;;;,,,'''''......'
NNNNNNNNWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXK00OOOkkkkkxddddxxxkkkxdddddoodxxxxxdxddkkxxddlldolll:;;:lloc;;:::;,',:lodxkkkkkddkOOkk000O0KOO0OOOOkkO0KXXXXXXXNWNNNXXNXXNNNXXNXKK0OOOO00K00XXNXNNNNNNNNNNNWWWWMMMMMMMMMMMMMMMMMMMMMMMMWMMMMWWWWNXK000OOOxxddooollc:;,'...........
NNNWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWXK0Okxxxkkkxdooooodooddxdollooddddxkkxxxxxkkkxxdolloool:;:clloo:;ccc;'',:lllodddodddxkxdxOOOOOOkk00kkkkxk0XK0KNNNNNNNXXXXXXXXKKXKK00OOOKKKKXKKXNNWNNNXXNNXXXXXXNNNWWMMMMMMMMMMMMMMMMMMMMMMMMWWWWMMWNXXXXXXXXKK0Okkdollcc;,'..........
WWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXKOkxdoooodxxxxdddolclllloodolclodxdxkkkkkkkkOkxxdlclolc:;cc::;::;;:lc;,,;llc:oddooodxxoldkxkOkxdkkdoooxOOKKKKXNNNNNNNXXXNNXX0kkkO0K0O00KXKKKXNNNNWNNNNWWWNNXXXNNNNNWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWMMWWNNXXK0Okxdoolc;,'.........
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXKOkxdolclodxxxxxdddddlcc:clllodoooodddxkkkkkOkOOxddo::odl;,:lcc:,:lclll::;;coolododdooddddddxxOxoodollodkO0KKXNXKKXXXXXXNNNNNX0OO0000K00OO00KXXXXNNNNNWNNNNNNNXXXNNNNNNWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMWWWMMMWWWWWWNX0OOkkxdolc:;,''....
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNK0Okxdolccclooddolcc::ccccclooooooooddddxkkOOOOOOOxdooccodo:,',:lc;cl::ol;;:::cllooodxdooddxxodxkkdlokxddxkk0KKKKKK0KKXXXXXXXXKKKKK00O0OOOOOKXXKKKXNNXXXNXKKKKKKK0KXXNNNNWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWNNNXKOkkxolc:;,,'''..
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWX0Okdoolc:,,,,,;,''.....'',;:::cclollodddxxkkOOOOOkkkdoolodc;;'.';:;:l:,:lc,,:::ccclooddooodxdooxkxoodxxddxxkO000OO0KXK00000OOOkddk0KKK0kkOO0KK0O0KXXXKXXNNNNXK0OOO0KKKKXXNNNNNWWWWWMMWWWMMMMMMMMMMMMMMMMMMMMMMMMWWWWNNNXK0Okkxxdolc;,....
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0kxdlc:;,,,''',,,,,,'......'',;;:ccccloddxxkkOO0OOOOxddoodl;,,,;;::clc:;:l;.,::clccolooodddxdodkkddxdxxxxkkkkkOOOO000OOOkkxddxxddOKXXKKK0kxkOO00KKXXXKKKNNNXK0OOkkkkkO0KKKXNWWWWWWWMMMMMMMWMMMMMMMMMMMMMMMMMMMMMWWWWNNX00OOOOkxdlc:;'...
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0kxolc:,,,,,,,;;:cc:,.',,;;;;,'',;;;::clodxxkOOO00OOkxdoodo:;,;:;:cllcc;;c:,.':coolllooodddxddxkxxdxxkxxxxdxkkkkkOkxxxkkkxdxkkxxkO000OOkxxdkO0XXXKKXXKK0K000KKK00OOOOO00KXNNWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWNXKKK0Okxxxdoll:;'..
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWN0kxdol:;;;;:::ccccc:,',:cloodolc:,,,,,,;;:lddxkOOO00OOxolloo:,';cc:;;::;:;','',:clolclolldodddxxxkxxkkxxxxkxkkOxxxxxxkkxkkkkkkOkxxdddooxkkOkxxxOO0O0KK000OkkOO000OOOOO0KKKKXNNNNNNWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWNXXK00Okxdoollcc:;,'
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXOxdolc::::clooool:'',::clloddddooc;,,'',,;codkkOOO0OOkdoooolc::codlc;,,:c;'',:::clllll::lloddxxkkxkkkxxkkxxxxxxxxxxxddxOOkkkkkxdooooollldxxxxkOO0KKKKKK0OO00kkkkOOOOO00KKKXNNNNNWMMMMMMWWWWMMMMMMMMMMMMMMMMMMMMMMMWWWNNXK00Okxdoollcc:;,,
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKkdollllllooodoo:'.',;::coddddxxddlc;,,'',,:ldkOkkOOOkxolclc:::::lol::;;:;,,:::;cccloo:;:codxkxkkxxkxxxxddxdddxdddddoooodoollllodxkxddolodddddxxO00O0KK000KXKOkxxkkOOO00KKXXXNNWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMWWNNXXK0Okxddoooollc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNKkdoooooooooddoc..''',;:clodddxkxddol;,,,,',;cdkOkOOOOxocc::,',cc::lcc:,,;:;;c:;cccloxxoclddxkxkkxkxddddodddddooollllccccccllccclodxkOxodxkkkxdodxkk00000OkO0KK0OkxxxkkO000KKXNXXXNNWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMWWNNNNXXK0kxxdooooll
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXOdooddddoddddc'..''',,;:cc:;cdkxxdddl:;,,,,,;cdkOOkkOOdlllc::;:llc;::;;,:cc::::llodddkkxxxxkxdxxxkxdooooddoollcc:cclc::cc::;,;;:clloolcclodkxdxxxxdxkOkxdxxkkkkkkkxxxkkOO00KKKKKXXNNNWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMWNNNXKK0Oxddoollc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOxdddddoodddo,..',''''';;'. .;dxxxxddl:;;;,,,;cxkkkxkOklllcccc::llc;'';;;:c:;;cloddddkkkxkkxxdxdxxdllolccc::;;;;;;;;,''.''',,,,',;:ccloolccooodxOOkkkkkxxxkkxdooodxxxxxkOOOOO00KKXXNNNNNNNNWWWWWWWWWWWWMMMMMMMMMMMMMMMMMWWNNXKK0Okxddool
NWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKkddddddoooooc. .,;''...''.   .:dxxddddl;,;;;;;;oxxddxkkdl:::clc;,;:;;'':;,;;;;ccoxkxxkkkxkkxdxdoddolc;,;;,''''''............',;,'.....;cloc::;;clllx0KOkkxdoodddooodolloddxkkkO0KKKXXXXXNNNXNNNNNNNNWWWWWWWWWWMMMMMMMMMMMWWNXK0OOkxxdool
XXNWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXOxddddddddddd;.  ':,.......   .,lodddddoc,,;::;;;lddddkkdlc:;:cccc,',;;;;;;::;;:lddxxkkkxxxkdoxollc:;;,,,'''''.....'''''',,,',,''.........';:c:'.....;cclooc:;,,;::ccccclloddxkkO00KKKKKXXXXXXXXXXXXXNNNNNNNNNWWMMMMMMMMMMMWWNXKK00Okxddd
0KXXNNNWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNKxdddddddddxx:.  .;;'',,'..    .cooodoool;,;:::;,;ldddxxxol:;::::cc;;,',,'';:;;cldxddxkkxdxddodl::;,,,,,''....'',;;::cccclccccc:;;,'........','''......';::::::;::::::ccccllodddxkkkOOOO0000000OO0000KKKKKKKXXNWWMMMMMMMMMMWWWNNX0OOkddol
dxO0KXXNNNWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN0xdddddoddddxc'. ..;,,,,,,..   .;clloolll:;;;;::;,:lodddddol:;:lllc:;,,',,,,,,:coxxdddxxxddoolcc;;;,;,''..',;;:cccccllllllllllllllc:;,'....'','''...';::c::ccc:c::::;::ccccccllloodxxxxxkkkxxkkkO00KKK00000KKXXNWWWWMMMMMMWWWNXX0kxddooll
lcldk00KXXNNNNNWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWN0xdddddoooodxo;.. ..,;;:;,,'...,:cccccclc:;'.';;,',:clllloooc;,:cc:;,,'.';;;:;;ldxxxdodoodddlc:;;;;;,...',::cclllllllllllllllllllcllc:;'......''...,:clllccllllllcc:;;:cccccccccllllllllloodddxxkkkkkOOOOO00KKXXNNWWWWWWWWNNNNXKKOkkxxddd
llclodxkO0KXXXNNNNNNWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0xooodollodxxl,..  ..,;:;;;,'';:::::::cc;'...'''.',:lcclcclc;,,;;,',,'..',::::coxddolooooll:;;,;;;,...,;:cccllooollllllllllllllccccccc:;'........,:cloddolooodoolllllccclllllc::::::::::cloooodddddxxxxkkkOO00KKXXNNNWWWWNNNNNXK0kxxddoo
kxoooooodxkO0KKXXXNNNNNNWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNKxolllllooodxxo;... ...''''''',;;;;;;,,,'........'',cclc::;:;,;::,,,'''',,;;::lodxkdlloocc;,,,;::,...,;:cllclllllcc;,.'';cccccclllllc::;,......,;cloddddxxdddddxxxxddoooooddxdddddolc:;;:ccllloooddddddxxxkkOOO00KKXXNNNXXXXKK0OOkxxddoo
WNK0kxdooooodxkO00KXXXNNNNNNNNWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWN0xolllccllloxxo:,... ...........................''.',:cc;';,'',,.......',;;;;cloddddocc:,'''',;;'..,;:clllllllll:..    .,;::cccccc:::;,,....':clllloddddxdxxkkkkxxdodddddooolllclolccclllllcccllooooddxxxkkkOO00KKXXXXXXXKK0Okxxddooool
MMMWWNX0OkxdoooodxxkO0KKXXXNNNNNNNNNNNWWWWWWWWMMMMMMMMMMMMMMMMMMMMWNKkoccc::;::::coddo:,'...........  .........''....,''..';;;',,'',;'.......',:::lcloooooc:,....',;,...,;:cllllllll:.       ..;:;;;;;;;;;,'....;cllllodoodddddxkkkxxxxxdddoooooddoooollcccccccc:c::ccllloooddddxkOO00KKKKKKKK0Okxddoollllll
MMMMMMMWWNNX0OkxddooodxxkO00KKXXXNNNNNNNNNNNNNNWWWWWWWWWWMMMMWWWWWNX0koc:::::;;,,;codxdlc:;,''.................'.....,,...''',',,'';:,.......'';:cloollllc:;'.....''....',:cclooollc,.        .';,,,,,,,''....':loooodddxxddddxkkkkOOOOkxkkkkxxddooodxdoc:ccc::;;;:::::ccllloodddxxkO0KKKKKKK00Oxoolllllcccc
MMMMMMMMMMMMMWWNXK0OkxxdddddxxkOO00KKXXXXNNNNNNNNNNNNNNNNNNNNNNNNNNXKOdcccccc;,''',;:looolc::;,,,;;;;;;;;;,'.........',,'....'',,,,,,'''..''',,;;::lolccc:;'.............';:clooolc:..        .',,,'''.......,cooddxxxddddddddxxxxkOOkkOOOOO0000OOkxddddollc:;,;;;;::ccc::::clodxxxkkOO0KKKKK0Okxddolcc:::::
MMMMMMMMMMMMMMMMMMMWWNXXK0OOkxxxxxxxxkkOO00KKXXXXNNNNNNNNNNNNNNNNNNXK0kollool:;;;,,',,;;:clloolclllllccc:;;,'.........''.......''.''',,''',,,,;::::;;;,,,,'.....    ......';coololc:'.        .',''........';cooodxxxxddddoooodddddxxxxxkkkkOO000KKKK0OOOkkdoc::::::;;,,;;::::cllodxxkOOOOOOOOkxolc::;;;;,,,
MMMMMMMMMMMMMMMMMMMMMMMMMMWWWNNXKK0OOkkxxxxxxkkkOO000KKKKXXXXXNNXXXK00kdllollc:::;;,'''',;;:ccccclclccc:;;:;,''..................''..'..'''''',;cc::;'..''.......    .......':cllllcc,...    ..''.........,:cllodxdooddooooooddooodddxkkxkOO000O0000OOkxxdolc;,''.''''''',;;:::ccloddxxkkxxdoooooolc::cc:::;
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWNNNXXKK000OOOOOOkOOOOOO00000000Okxolllcc:::;;;;,''..',,,,,;;;::;;;,,;;,,,'......'..........''....'......'',;,,'..............   .. .....';;;;::;,.................';coooooooooollcloooodxxdodxxxxxkkxdodkO0000Okxdooolllc:;,'''''''',,,;::cclodddxxxxdoollcc::::::::::
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWNNNNXXXXKKKKKKK00OOkdolc:;;::;;;,,'.''...'..''','''',,,,'''......'''............''............''...................   .....'',,;;,,'........ .....';cclooooooooooooddxkkxxkkkxxOOOOkkOOOkkkkxkO00KXKOkxdocclllc:;,'''''',,,;;::ccloodddolccccccc::;;;;;;
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWNNX0koc:;;;;;;;;,,''''.............',,,'.....................'......................    ....'........  ........''.....     .....,:cclllloooollllllllodxxddxxdxkkOKK000OOOOOkkkkxxkO00Okxdolc:;:ccc:;;,'''',,,;::ccccccccccc::ccc:::;;;;;
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXOxoc::;;;;,;;,,,'....'...........'','....................''...............          .......'''................   .......',;:clllloooooooooddoccclllodooolllllllllodkkkxkkkOOO00OOOOkdl:;;;;,''',;;;;;;;;;;;;;::::::cc:::;;;;;;;:::;;
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXK0xlc:::;,,,,,,,'.''.'...'......'',,'.....................'''....... ...             .....'',,,,'..................''',;::ccclllclccccc::ccc;;;::;,,;:cccccloolcllldxkxdxxxkkkOOOOkxdollllc::;,;,,,,,;;;;;;::::::::::;;;;;;;;;;;;;;;
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNNNXKOdlc:;;,,''',,,,;,''''''.....'''..................................                .....''',,;::;,,'...........''';::ccc:::cllolllcc::::;,'..'',,,,,;:ldocoxkOOOkkkxk00kxxxxkkkxxxxkxddddooolllc:;;::;;::::::cccccc::::;;;;;;::::::
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWNXK0xl;'''''''',,,,;,,,''''..'......................................                  ...',;;,,;:cc:::;,',,,,;;;;,''',;;::c:::ccc:;,,,,,,'',''',''',,,;:clloddddoxOkxxxxkkkOkxxdolccccllooooolooollcc:;;;::clloollccccc:::;;;;::::::c
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNX0xl;,,,;;;;;,,,;;;;;,;;,,''...''....................................              ....''.''';:::c::cc:;;;;::ccllllccccc:;,,,,,,,,,'.''.......,,'''',;:::ccccllclddxxdooodxxxdocccc:::::ccllllc:cccc:::::cclloddolcc::::::::::ccccc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXXK0koc:::;,,,;;;;;;;;;;:;,''''',,,................................  .          ..  ...''..',',;,,;;;;;::clc::cc:::c:::;,,,'....'''..............',;;'',;;::;:cc:::clddoolllcclll:::c::::::::looooc:::ccclllllllllllllcccccccccccccc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWNNKOxocc::;;:ccc::cccc::;;,,,,;;,,''......''......................          ...... ....''...'''''...'''',;;;,',,'''..''''''.......'..........'''.',,,'',;:::clc::ccc:cllccllcllcc:;;;;;;;;;;:clooddollllloddddollcccccccc:::cccccll
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWNK0Okdocclllooollllc:::c:::::;;;;,'....'''''''................             ..  .........................'........'...............',,'..'''.',,'','.',;;::cccooc:::;;;:::cccllccc:::;,;;;;;;:::ccldxdolooooooooolcc::::::cccccllll
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWNNNXK0000Oxxxdolcc::cllcccc::::::;,'.';;;;'''''''............                ...................................'''........',,,,,,,,'',;;,'',;:::;,,;:ccccc::::::::;,,;cllc:::::;;;;;;;;;::::ccccclodoooooollllccccc::ccccllllll
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWNX0Okxddolclllllc::::ccc:;;;,';;;;;,,',;,'''............      ...    ...............................'......,,,,,'''''',,,,','';;;;;;::;;;:::;,,;:clllc;,;;;:;;,'';clcc:::cc:;:::::::::::ccllloollccccccc:ccccccccclllcccc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWNXK0Oxdolllllolc:::clccc:;;,,,,',,'',;;,,,'..............    ...........''........................,'..'''',,,,,,;c:,',;;:;;;,;:c:;,,,,;;::;;;;,',;;::::;,,;;;;;,,,;:cc:::ccc::::::::c:;;:cclllolc::ccccccccccccccccccccc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWNNNXXXK0kdolcccclc::;cllllcc:;;,''',,..,,'''''............................''''............'...........'..'''''',;;;;::c:;;;,;;;,;::c:;;,,,,;::::;,,,',;;:c:;,,;;;;;:::::cccccclooccc::::cllc:::cclllccc:ccllllllccccccccccc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWNXKOxdolllccc::;;cloooolccc:;'';::;;;,''......................'''.''.''',,,...''......................'''...';;;;,,;,'''',,,,::::;,,;::;;::c:;;;;,,;:cll:;,,;;:::ccllllllllloollccc:::llllcccccllccc:cccccccllllllllllc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWNNNWWNNXK00Okxdddolllllloddddddoool:;,',ccccc::;,''....  ........'.',',,,,,''''',;,'''',......................''..'',;;;,;;:;'...'',,,,,;;,,;:::;;::::;;::;;;:ccc:;;:::cccloollloooooddolcccc::coolccccclccccccccclcllllllllll
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXNNWWWWNXXKK000Okkxddooooooddddddddddooc:,';clcccc:,. .....     ...',',;,,,,,,,,',;;;;,''',,'................',....''''..'''',:::,''''',''',;c:::clc;,,;::;;;;;:::cllccccccllodddddddooooddxxdolccccloolccccccccccccllllllllccccc
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWMMMMMMWWNXKKXNNNX0OOOOO000OOkkxdollccccloodxxddddddoc;'.;ccccc:,.   .....'.','',,,,,;;,,,;;,,,;::::;;;,','...............','..''''....'''',;;;,,,,'''''..':ccc::;;,;,;:clc::cccllooollllooodxxxxxxdddolloddddoolllloolllclllllllllllllccccc::
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWWNXK0O00KK0Okdooodddxxkkkkxxddooollllloxxxxxxxxxdoc;'',;,;::,.  .';,,;;,;:;;;;,,;;;;;;::;,''',;:ccc;,,,...............',''''',,'..'',,,,,,,,,;;,'',,,,,,;:cc:;;;;;;;;:lllclllooooddooooooodxxxxxddddoolllodddooooooolllllllllllllllccccccc
WWWWWWWMWWWWMMMMMMWWWWMMMWWWWWWWWWWWWMMWWMMMMMMMWWWWWWWWWNNNWNNNXK0Okkkkkkxxdolllloodddxxkxxxxddxdddddddxxkkkkkkkkkkxdl;....''.. ...',,;;;clccc:;,;:::;;;;:;;'..',;ccc:;:;,''''.........''..''',,,,,,,,;;;::;,,,,,,,,,,;;;;;:cllccccccc:ccllllooddddxdddoooooodddxxxxxddoolllooololllllcclllllllllllllcccccc
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNNNNNXK0OkkkkkxxdoolllllooodddddddooooddddddddxxkkkkkkkkkkkOkkxdo:.........,,,;::clooollc:;;:::;;,;::c;'''..',:cllc:,',,''..............''';;;,,,;;:;;;,'',,,,;;:::::::cllllllloollloooloddddxxddooollloolllodxxxxdooooooollllllllllllllllllllccccccc
NNNNNNNNNNNNNNNNNWWNNNNNNNNNNNNNNNNNNNNNWWNNWWWWWWWWWNNNNXK0kkkkOOOkxdooollllooooollllooooolloooddddddxxkkkkkkkkkkkkkxdol;....';:cllcloodooloollcccc:,''.',,;::;,,'.'';llc:::;;;,'..'..'''...'....',,,,,'',;;;;,,,,;;;;;:::clccllllooooooooooolloodddddoolclllloollcclodxxddddddddoolllllllllllllllllcccccc:
NNNNNXXXXNNNNNNNNNNNNNNNNXXXNNNNXNNNNNNNNNNNNNNNNNNNNNNXKOxdxk000Oxdoollllllllllllllolllllllllooddxddddxxkkkkkkkkkkkxxxdoc,.',clloxxxxddddoooloolclc:,,''....',;;,,,;;;ccclllllcc:,'''',,;,'.'''...'''''''.';;,,,,,,,;;;;::cllooodoooodddddooollllllloolllllllcllooolooloddxxddddxxxdollllllllllllllllcccccc
NNXXXKKKKKKKXXXXKKKXXXXXXXKKKKKKKKKKKKKKKXXXXXXXXXXXXKOxoodxxkkkxdollllllllllllllllllllllllloooooddddxxxxxkkkkkkkkkkkkkxdl:;:ccccoxkkkkkxxdoddooooolccc:;'....',;,..',,;:::cccllll:,,;;,;;:;,;;,,'.',,',,,''',,,,,;,;;;;;;:cclllooddooooodddlccccccccclllllllllllclloooooooooodddddxxxdoollllccccccccccccccc
NXXXKK00000000000000000000000000000000000000000000Okdolllooodoooollllllllllllllllllcccccclllollllooodxxxxxkkkkkkkkkkkkkkxdlcccclcldxxkkkkkxddxolccllllllc;,;:;;;;;'....'',;;;::lolc:::::::cc:cc::;,,;:;;;::;,;;;;;;::::c:;:clllllooddddooodddolcccccllloollllllooooloollloooddooddddddxdolllcccccccccccccccc
XXXKK00OkkkkkkkkkkkkkkkkkkOkkkkkkkkkkkkkkkkkkkxxdolcclloooooollllllllllllcccllllllcccccccllllclllllooooodxxxxkkkkkkkkkkkkxdollllodxxxxkOOkkkxxdl::::clcc:;,;:lllcc;,;;,,,,,',,,;llcllccccccccccllllcccccc:cc:::::::cccllllcclloooooodddddoodxddoollllloodddoolloooolooddollllooddddoooooollllccccccccccccccc
XXKK00Okxxddddddddddddddddddddoooooooooooooollc::cclloooooooollllllllllllcccclllllcccccccccccclclllllloooddxxxkkkkkkkkkxxdolccclodxxkkkkOOkkkkxdolc::c::;,,,,;cccc::clc::::,,,;;;:;:llccccccclllllloooloollllllllllllooooooooooooolloooooddodxdooollooooloodddooooooooooolllllllllooooollllllllllccccccccccc
XXK00OOkxddoollllllllccccccccccccccccccc:::;;::cllllooooooooooolllllllllllcccccccccccc:cccc::ccclllcloloooooddxxxkkkkkxxdolc:;;;codxxkkkkkkkkkkxxdoollllccc::;:c:cc:clcclolc;,;;::;;::::::::::clccllloooooooooooooooooooodddooddddoolloooodxddxdoooooooooooooooooollllllllllllllcccccllllllllllllcccccc::::c
NXK00Okxxddoolllcccccccc::::::::::::::;;;;;:clllllllooooooooooooolllllllllccccccccclccccccc:::::cccllllolllooooddxxxxxxxdddol:;,;:codxkkkkkxkkkxxxxxxddoooollc:cccc:::cclddol::::::::::;;;;;;;::::cllclloooooooooodddddddddddddddddddoooooodxxdxxdoooooooooooollllllccccccllllllllccccccccllcccccccccc::::;;
NXK00Okxxxddolllcccccccc:::::::::::;;;;;:clllllllllllooooooooooooollllllllcc:::::cccclllccccc::::::cclllllllllloodddxxxxxxxddol::::clodxkkkkxkkxdooddddddolllolllolcc:cccoddooolcccccccc:::::;;;::ccllcllodddddddddddddddddxxxxxxdddddddddddddddxxddooddddoooooooollcccccccccc::ccccccccccccccccccc::::::::;
NNXK00Okkxdddoollccccccc:::::::::;;;;:clllolllllolllloooooooooooooolllllllllcc::::::ccccclllcc:::::cclllllllllllloooddxxxxxxxdolcc:ccclodxkkkkkkxdoddddddolllooooooolollloooooooollcclccllllllccccloooollloddddddddddddddddxxxxxxxxxxdddddddddxxxxxxddddddddddddddoollccccccccc::::::cc:::cccccccc:::::::;;;
NNNXK00Okkxxdoolllcccc:::::::::;;;:clllloooollllllllloolllllllllllllllllllllllccccc::::::ccclcccccccccccccccccccccllodxxkkkkxxxdolccccclooddxxkkkkxxxxxxddooooooolllllooodddoooodoolllollloooooolllooodddooodddddddddddddddddxxxxxxxxxxxxxxxxxxxxxxxxxdxxxxdddddddddoollccc::ccc::::::::::::::cc::::::;;;;;,
NNNXXK00OOkxxdoolllccc::::::;:::clllllooooooolllllllllllcccllllccllllllcclllclllllllc:::cc:::ccclllllcccc::::::::ccloddxxkkkkkkxdollllooooododxkkkkxxxxxxxxdddddolllccllloodooodddooooodolloooodddoooooooddddooooddddddddddddddxxxxxxxxxxxxxxxxxxxxxxxxdddxxddddddddddoollcc:::cccc::::;;;;;:::::::::;;;;;;;
WNNNXXK00Okkxxdoollcccc:::::ccllooooooooooooollllllcclcccccllllllllllllccccc:clccclllccccc:::ccccccclllcccc:;;;::::cloooddxkkkkkkxxdddddddddoddxxxxxxxxxxxxxdddddooollllllllllooodddddddddddoooodxxxxxdoooodddoooddddddddddddddddxxxxxxxxxxxxxxxxxxxxxxdddddxdddddddddoollllc::::cccc::::;;:::::::::::;;;;;;
WWNNNXXK00Okkxddoolccc:::clloooooooooooooooolllllllllllcccccllllllllllllllcccccc::cccccccllccclcccc:::cccccccc:::;:cclllloodxkkkkkkkkxxxxxxxxxxxxxdddxxxxxxxxxddxxxdoooooooolllllooddddxxxxxxolooddxxxxxxddddddddddxxddddddddddddxxxxxxxxxxxxxxxxxxxxxxxxddddddddooooooollllcc::::cccc:::::::::::::::::::::;
WWWNNXXXK00Okxxdoolccclooooooooooooooooooooolllllllllccccccllllccccccclllllllllcccc::cc:ccllllllccc::::c:::cccccc:::ccccccccloxkOOOkkkkkkkkkkkxxxxxxddxxxxxxxxxxxxxxdddddddddddddddoooodxxxxxxdooddddxxxddddddxxxxxxxxxxdddoddddddxxxxdddxxxxxxxxddxxxdddddddddddoooooooollccc::::::ccc::::::::::::cccccc:::
WWWNNNXXKK0OOkxdollodxxddddooooooooooooollloooollllllccccllcccccccc:::llllcllllllllcccc:ccc:cccclllccc::;;:cc::cccccccccc::;::ldkkOkkkkkOOkkkkkkxxxxxxxxxxxxxxxkxxxxddxxxxxxxxxxdddddddodxxxxxxdddxxddddddddddxdxxxxxxxkkxdddddddddxxxddddddddddddddddddooooddddooooooooollccc::::::cccccccc::::::::cccccccc
NNNNNNXXXKK0Okdddxxkkxxdddoooooooooooooooooooolllllllllccc::clllllccccclc:::clloollllllccccclcccccccccc:;::::::ccccccccc:;,,,,;clodxxxkkkOkkkkkkkkkkkkkkkkkkxxxxxxxxxdxxxxxxxdddddddddxxddxxdddddddxxxddddddddxxdddxxxxxkOkxdddddddddddddoooooooooooooooooooooooooollllllllcc:::::::ccccccccccccc::::::::ccc
NNNNNNXXXK0OkxxkOkkxxdddoooooooooooooooooooolllllllllcc:::;;:lllllllllllcccccclllclllllllllllllcc:::c:::cccc::::::ccccc:;,'''''',;;:cclodxkkkkkkkkxxkkkkkkxxxxxxxxxxxxddddddddoooooooooodddxxdoooddxxxdddooddxxxxxxxxxkkkkO0Oxdddddooooooolllllllllllllllooooooodoollllllllcc::::::ccccccccccccccccccc::::::
NNNNXXXK0OkkOOOOkxxdddooooooooooooooooooooolllllllllc::;:;;;;:cccllooolllllllcccccclloolllllllllcc:::cccccccc::::::::::;;,'.........',,;::coodddxdddddddddddddddddddddddooooooolllllllllllodkxdooodddddddddddxxxxxxxxxxkO0OO00Oxddooollllllllllllllllloollllllloodoolllllcccccc::::ccccclccccccccccccccc::::
NNNXXK0OO0000Okkxxdddooooooooooooooooooooolllllllllllc:;,,;::cc:cclllloooollllllcccllllllllllllllllccccc::cc::;:;;::::;;,''................;;;::ccclccllloolllllllooooooollcclolllcccccccclldxxddooddddddddxxkkkxxxxxkkkkk00000K0kdolllllllllllllllllllollllllllloooolllllccccccc:::cccclllcccclcccccccccc::
XXK0000KKKK0OOkxxdddooooooooooooollccllllllllllllllllcc:::cclccccllc:cllllloooolllllccccllccccllllllllllcccccc::;;;::;,,'......           ......'',,;;::::ccccccccllllllllcccclollclccccc:clloddddddddddddddddkO0OxdxxxkOkkk0KKKXX0xolllllllllllllllllllolllllllllllllllcccccccccccccccllllllcccccccccccccc:
K0KKXNNXXK00Okxxddddoooooooooolcccccclllllllllcllllllllllllllllccc:::ccccclooooooollllcccc:::c:::cloooolllccc::::;;;;;,''......                .....'''',,;;;;;:ccccllllccccccllollllccc::clloddddddddxddoooddddxO0kxxxxxkOOkO0KKKXX0xooloollllollllllllllllccclllllllllcccccccccccccccclllllllc::::cccccccc
XNWWWNNXXK0Okkxxddddooooollccclccccllllllllllllccllllllllllloooollllcccccclooooollllllllllcc:::::llolllllllc::;::;;;;;,''......                    .......'.'',;;:cccccccccccccclolllcccccclooodddddddxxddooooooodx0KOxxxxdxOOkkOKKKXKOxoooollooolllllllllllccccclllccllllccllllcccccccclllllllcc::::::::::c
MMMWWNNXXK0Okkxxdddoooolllc:clllllllllloooollllllllcclllllloooooooollcc::clcclllc::ccclllllcccccclllllllllc:;;::::::;;;,,''.....                        .......',;::ccc::::ccccccllllcccccloooodddddoodxkxdooooooooox0K0kxdxxxOOOkOKKXXX0kdooloooollllllllllcc::::cllllccllllllllllccclllllllllcc:;;;;;;;;;;
MMMWWWNNXK0OOkxxxdooooolccccloooolllllloooolllllllllllccllllloooooolllccllllllcc:ccc:::cccccccllllllllllccc:;:cc:::::;;,,,''.....                        .......',,;;;;;::::cccccclllccccllooooodxddooodxkxdooooooollox0K0kxxxxkO00OOKXXNNK0kdoooolllllllllllcc::::cccllccccclllooolllllllllllccc::;;,,;;;,,
MMMWWWNNXXK0Okkxxdolllllllllloooooolllllllllllllllllllllllcllllloooooollooooolc::clcc:::cc::ccloooolllllcc:;;:::;;:::;;,,,,'.....                             .....''',;:::::::cccllllccclloooooodddoooodxOxdoooooollllox0KK0OkkkO0K0OOKXXXXK0Okdoolllllllllllcc:;;::cllllccccllloooooollllllllcc::::;;,;;;,
MMMWWWNNXXK00Okkxxddoooooooloooooooooollllllllllllllllllllllllllllloooooooooolcclllllcc:::;:clloolllllllllc::::;,,;:;,,,,,,''.....                              .....',;::::::::ccclllccllooooooooooooooodkOkxdoooolllcccox0KKK0OkOO00KOO0XNXK0OOOkxolllllllllllc:;;;:ccllllccclllooooooollllollcc:::::;;;;,
MMMWWWNNXXKK0Okkxxxdddooolllooooooooooooolllccclllllllllllllllllllllllloooololllllllllllcc::cllllllcccllllllccc:;;;;,,,,;;,,'..........    ...                   ....',,;;:::::::ccclllllloooooooooooooooodkOkxdoooollcccccdO000KK0OOOKXKOO0XNNKOkkOOOxdoooooooolc::;:cccllllccccllooooooolllloollccc::::;;;
MMMWWWNNXXKK0Okkxxxddoooooollloooooooooolllllllcclllllllllllllllllllllllllllllllllllllllllcccccllllccclllclllllcc::;;,,,,;;,'..................                ......''',;;;::::::ccclllllloooooooooooooooodkOkxddooolcccclloxO000KK0OOOKXKOOKXNNKkxxkOOOkdoooooooc:::cccllllllcccloooolooollllooolccc:::;;;
MMMWWWNNXXK00Okkxxdoollooooooollllooooooollllllllllccllllllllllllloollllllllllllllllllllllllllllllcccllcccllccccccc:;;,,,;;,''.................                 .........,,;;;;::::ccclllllllloooooooooooooodkkxxdddollllllloodk00OO0XK0OO0KKOOKNNX0kddxkO0Okxddddol::ccllllllllllcloooollloollllolcc:::::;;
MMMWWNNNXXK00OOkxdooolllloooooooolllllllllllllllllllllllllllllllllooooolllllllcllllllllllllllllllllllccccclc:;:cccc:;;;;;;;,,''.'............                          ...',;;;:::ccccclllllllloooooooooooooodkkxdxxdollllloooddxk0Okk0XX0OO0KK00XNNX0kxddxkO00Okxdolc:clllllllooollloooooloooollllcc:::::::
MMMWWNNNXXK00OOkxddollllllloooooooollllllllllllllllllllllllcllllllloooooloollllllccllllllllllllllllllllllcccc::ccc:,,;;;;,;,,'......  .....                             ..',;;;:::cccccccllllloodooooooooooooodkkxddddooloooooddddxkOOxxOKXKOO0KK00XNNKOkxdoodkO00Okxolcclooolllooooloooooolloooolllcc::::::
MMMWWNNNXXK0OOkkxxdollllcclllloooooooollllllllllllloooollllcccclllloooooooollllllllcccllllllllllllllllllllcccc:;::;,;::;,,,,'...                             .          ..',,,;;:ccccccccllllodddooooooooooooddxkkdoodddooodddddddddkOOxdx0NX0OOKK0OKNNKOkxdooodxk0K0kdlllloooooooooooooooollloooolllccc::::
"""
n = int(input())
a = []
cnt_num = dict()
for i in map(int, input().split()):
    cnt_num[i] = cnt_num.get(i, 0) + 1
    a.append(i)
if n == 1:
    print("YES")
    print(*a)
    exit(0)
matrix = [[0] * n for _ in range(n)]
for i in range(n // 2):
    for j in range(n // 2):
        for k, am in cnt_num.items():
            if am >= 4:
                matrix[i][j] = k
                matrix[i][n - j - 1] = k
                matrix[n - i - 1][j] = k
                matrix[n - i - 1][n - j - 1] = k
                cnt_num[k] -= 4
                break
        else:
            print("no")
            exit(0)
if n % 2:
    for i in range(n // 2):
        for k, am in cnt_num.items():
            if am >= 2:
                matrix[i][n // 2] = k
                matrix[n - i - 1][n  // 2] = k
                cnt_num[k] -= 2
                break
        else:
            print("no")
            exit(0)
    for i in range(n // 2):
        for k, am in cnt_num.items():
            if am >= 2:
                matrix[n // 2][i] = k
                matrix[n // 2][n - i - 1] = k
                cnt_num[k] -= 2
                break
        else:
            print("no")
            exit(0)
    for k, am in cnt_num.items():
        if am >= 1:
            matrix[n // 2][n // 2] = k
            break
    else:
        print("no")
        exit(0)
print("YES")
for i in matrix:
    print(*i)