#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)

typedef long long lli;
const lli MaX = 100005 , infi =1110111110111 , mod = 1000000007 ;
typedef pair<int,int> pii;
const int MX = 200005;

lli n ,a[2200] , occ[5000] , mat[1000][1000],x,err;
vector<int> v;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n*n;i++)
    {
        cin>>a[i];
        occ[a[i]]++;
    }
    for(int i=1;i<=1000;i++)
    {
        err+=occ[i]%4;
        if(occ[i]%4==1)x=i;
        for(int j=0;j<occ[i]/4&&occ[i]%4==0;j++)v.push_back(i);
    }
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)mat[i][j]=x;
    if( (n%2==0&&err) || (n%2&&err!=1) )return cout<<"NO",0;
    int ii  = 0;
    for(int i=1;i<=n/2;i++)
    {
        for(int j=1;j<=n/2;j++)
        {
            mat[i][j] = mat[i][n-j+1] = mat[n-i+1][j] = mat[n-i+1][n-j+1] =v[ii];
            ii++;
        }
    }
    cout<<"YES\n";
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            cout<<mat[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)

typedef long long lli;
const lli MaX = 100005 , infi =1110111110111 , mod = 1000000007 ;
typedef pair<int,int> pii;
const int MX = 200005;

lli n ,a[2200] , occ[5000] , mat[1000][1000],x,err;
vector<int> v,vv;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n*n;i++)
    {
        cin>>a[i];
        occ[a[i]]++;
    }
    for(int i=1;i<=1000;i++)
    {
        if(occ[i]%4>1)vv.push_back(i),occ[i]-=2;
        err+=occ[i]%4==1;
        if(occ[i]%4==1){x=i;if(n%2==0)return cout<<"NO",0;}
        for(int j=0;j<occ[i]/4;j++)v.push_back(i);
    }
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)mat[i][j]=x;
    if((n%2&&vv.size()>n-n%2) ||(n%2==0&&vv.size()) )return cout<<"NO",0;
    int ii  = 0;
    for(int i=0;i<n/2;i++)
    {
        for(int j=0;j<n/2;j++)
        {
            mat[i][j] = mat[i][n-j-1] = mat[n-i-1][j] = mat[n-i-1][n-j-1] =v[ii];
            ii++;
        }
    }
    for(ii;ii<v.size();ii++)
    {
        vv.push_back(v[ii]);
        vv.push_back(v[ii]);
    }
    int ix = 0;
    if(n%2)
    {
        for(int i=0;i<n/2;i++)
        {
           mat[i][n/2] = mat[n-i-1][n/2] = vv[ix++] ;
        }
        for(int i=0;i<n/2;i++)
        {
            mat[n/2][i] = mat[n/2][n-i-1] = vv[ix++] ;
        }
    }
    cout<<"YES\n";
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<mat[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)

typedef long long lli;
const lli MaX = 100005 , infi =1110111110111 , mod = 1000000007 ;
typedef pair<int,int> pii;
const int MX = 200005;

lli n ,a[2200] , occ[5000] , mat[1000][1000],x,err;
vector<int> v,vv;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n*n;i++)
    {
        cin>>a[i];
        occ[a[i]]++;
    }
    for(int i=1;i<=1000;i++)
    {
        if(occ[i]%4>1)vv.push_back(i),occ[i]-=2;
        err+=occ[i]%4==1;
        if(occ[i]%4==1){x=i;if(n%2==0)return cout<<"NO",0;}
        for(int j=0;j<occ[i]/4;j++)v.push_back(i);
    }
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)mat[i][j]=x;
    if((n%2&&vv.size()>n-n%2) ||(n%2==0&&vv.size()) ||((n-n%2)-vv.size())%2 )return cout<<"NO",0;
    int ii  = 0;
    for(int i=0;i<n/2;i++)
    {
        for(int j=0;j<n/2;j++)
        {
            mat[i][j] = mat[i][n-j-1] = mat[n-i-1][j] = mat[n-i-1][n-j-1] =v[ii];
            ii++;
        }
    }
    for(ii;ii<v.size();ii++)
    {
        vv.push_back(v[ii]);
        vv.push_back(v[ii]);
    }
    int ix = 0;
    if(n%2)
    {
        for(int i=0;i<n/2;i++)
        {
           mat[i][n/2] = mat[n-i-1][n/2] = vv[ix++] ;
        }
        for(int i=0;i<n/2;i++)
        {
            mat[n/2][i] = mat[n/2][n-i-1] = vv[ix++] ;
        }
    }
    cout<<"YES\n";
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<mat[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)

typedef long long lli;
const lli MaX = 100005 , infi =1110111110111 , mod = 1000000007 ;
typedef pair<int,int> pii;
const int MX = 200005;

lli n ,a[2200] , occ[5000] , mat[1000][1000],x,err;
vector<int> v;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n*n;i++)
    {
        cin>>a[i];
        occ[a[i]]++;
    }
    for(int i=1;i<=1000;i++)
    {
        err+=occ[i]%4;
        if(occ[i]%4==1)x=i;
        for(int j=0;j<occ[i]/4;j++)v.push_back(i);
    }
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)mat[i][j]=x;
    if( (n%2==0&&err) || (n%2&&err!=1) )return cout<<"NO",0;
    int ii  = 0;
    for(int i=1;i<=n/2;i++)
    {
        for(int j=1;j<=n/2;j++)
        {
            mat[i][j] = mat[i][n-j+1] = mat[n-i+1][j] = mat[n-i+1][n-j+1] =v[ii];
            ii++;
        }
    }
    cout<<"YES\n";
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            cout<<mat[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)

typedef long long lli;
const lli MaX = 100005 , infi =1110111110111 , mod = 1000000007 ;
typedef pair<int,int> pii;
const int MX = 200005;

lli n ,a[2200] , occ[5000] , mat[1000][1000],x,err;
vector<int> v,vv;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n*n;i++)
    {
        cin>>a[i];
        occ[a[i]]++;
    }
    for(int i=1;i<=1000;i++)
    {
        if(occ[i]%4>1)vv.push_back(i),occ[i]-=2;
        err+=occ[i]%4==1;
        if(occ[i]%4==1){x=i;if(n%2==0)return cout<<"NO",0;}
        for(int j=0;j<occ[i]/4;j++)v.push_back(i);
    }
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)mat[i][j]=x;
    if((n%2&&vv.size()>n-n%2) ||(n%2==0&&vv.size()) &&((n-n%2)-vv.size())%2 )return cout<<"NO",0;
    int ii  = 0;
    for(int i=0;i<n/2;i++)
    {
        for(int j=0;j<n/2;j++)
        {
            mat[i][j] = mat[i][n-j-1] = mat[n-i-1][j] = mat[n-i-1][n-j-1] =v[ii];
            ii++;
        }
    }
    for(ii;ii<v.size();ii++)
    {
        vv.push_back(v[ii]);
        vv.push_back(v[ii]);
    }
    int ix = 0;
    if(n%2)
    {
        for(int i=0;i<n/2;i++)
        {
           mat[i][n/2] = mat[n-i-1][n/2] = vv[ix++] ;
        }
        for(int i=0;i<n/2;i++)
        {
            mat[n/2][i] = mat[n/2][n-i-1] = vv[ix++] ;
        }
    }
    cout<<"YES\n";
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<mat[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)

typedef long long lli;
const lli MaX = 100005 , infi =1110111110111 , mod = 1000000007 ;
typedef pair<int,int> pii;
const int MX = 200005;

lli n ,a[2200] , occ[5000] , mat[1000][1000],x,err;
vector<int> v;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n*n;i++)
    {
        cin>>a[i];
        occ[a[i]]++;
    }
    for(int i=1;i<=1000;i++)
    {
        err+=occ[i]%4;
        if(occ[i]%4==1)x=i;
        for(int j=0;j<occ[i]/4;j++)v.push_back(i);
    }
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)mat[i][j]=x;
    if( (n%2==0&&err) || (n%2&&err!=1) )return cout<<"NO",0;
    int ii  = 0;
    for(int i=0;i<n/2;i++)
    {
        for(int j=0;j<n/2+n%2;j++)
        {
            if(j==n/2+n%2-1)
            {
                mat[n/2][i] = mat[n/2][n-i-1] = v[ii];
            }
            mat[i][j] = mat[i][n-j-1] = mat[n-i-1][j] = mat[n-i-1][n-j-1] =v[ii];
            ii++;
        }
    }
    cout<<"YES\n";
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<mat[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PI acos(-1)

typedef long long lli;
const lli MaX = 100005 , infi =1110111110111 , mod = 1000000007 ;
typedef pair<int,int> pii;
const int MX = 200005;

lli n ,a[2200] , occ[5000] , mat[1000][1000],x,err;
vector<int> v,vv;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n*n;i++)
    {
        cin>>a[i];
        occ[a[i]]++;
    }
    for(int i=1;i<=1000;i++)
    {
        if(occ[i]%4>1)vv.push_back(i),occ[i]-=2;
        err+=occ[i]%4==1;
        if(occ[i]%4==1){if(n%2==0||x>0)return cout<<"NO",0;x=i;}
        for(int j=0;j<occ[i]/4;j++)v.push_back(i);
    }
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)mat[i][j]=x;
    if((n%2&&vv.size()>n-n%2) ||(n%2==0&&vv.size()) ||((n-n%2)-vv.size())%2 )return cout<<"NO",0;
    int ii  = 0;
    for(int i=0;i<n/2;i++)
    {
        for(int j=0;j<n/2;j++)
        {
            mat[i][j] = mat[i][n-j-1] = mat[n-i-1][j] = mat[n-i-1][n-j-1] =v[ii];
            ii++;
        }
    }
    for(ii;ii<v.size();ii++)
    {
        vv.push_back(v[ii]);
        vv.push_back(v[ii]);
    }
    int ix = 0;
    if(n%2)
    {
        for(int i=0;i<n/2;i++)
        {
           mat[i][n/2] = mat[n-i-1][n/2] = vv[ix++] ;
            mat[n/2][i] = mat[n/2][n-i-1] = vv[ix++] ;
        }
    }
    cout<<"YES\n";
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<mat[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    if(n==1)
    {
        p1("YES");
        p1(*s.be);
        return ;
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        lli i=0, j=0;
        vll vec;

        deb(n/2-1);
        while(1)
        {
            // deb(i, j);
            vec.pb(mp(i, j));
            vec.pb(mp(i, n-1-j));
            vec.pb(mp(n-1-i, j));
            vec.pb(mp(n-1-i, n-1-j));

            if(i==n/2-1 && j==n/2-1)
            break;

            if(j == n/2-1)
            {
                i++;
                j=0;
            }

            else
            j++;
        }

        vl v;
        lli cnt=0;
        for(auto it : s)
        {
            if(mm[it]%4==0)
            {
                forz(i, mm[it])
                v.pb(it);

                cnt += mm[it]/4;
            }
        }

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO");
            return ;
        }

        lli curr=0;
        forz(i, vec.si)
        {
            arr[vec[i].fi][vec[i].se] = v[curr];
            curr++;
        }

        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                forz(i, mm[it])
                v.pb(it);
            }
        }

        vl rem;
        set <lli> remset;
        mll remmap;
        for(lli i=curr; i<v.si; i++)
        {
            rem.pb(v[i]);
            remset.in(v[i]);
            remmap[v[i]]++;
        }

        lli oddcnt=0, oddel=-1;
        for(auto it : remset)
        {
            if(mm[it]%2 == 1)
            {
                oddcnt++;
                oddel = it;
            }
        }

        if(oddcnt != 1)
        {
            p1("NO");
            return ;
        }

        arr[n/2][n/2] = oddel;
        {
            mm[oddel]--;
            if(mm[oddel]==0)
            remset.erase(oddel);
        }

        deb(remset);

        i=n/2; j=0;
        for(auto it : remset)
        {
            deb(it);
            bool bo=false;
            while(mm[it]!=0)
            {
                arr[i][j] = arr[i][n-1-j] = it;
                mm[it]-=2;

                j++;

                if(j==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }

        i=0; j=n/2;
        for(auto it : remset)
        {
            bool bo=false;
            while(mm[it]!=0)
            {
                arr[i][j] = arr[n-1-i][j] = it;
                mm[it]-=2;

                i++;

                if(i==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }
    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    if(n==1)
    {
        p1("YES");
        p1(*s.be);
        return ;
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        lli i=0, j=0;
        vll vec;

        deb(n/2-1);
        while(1)
        {
            // deb(i, j);
            vec.pb(mp(i, j));
            vec.pb(mp(i, n-1-j));
            vec.pb(mp(n-1-i, j));
            vec.pb(mp(n-1-i, n-1-j));

            if(i==n/2-1 && j==n/2-1)
            break;

            if(j == n/2-1)
            {
                i++;
                j=0;
            }

            else
            j++;
        }

        vl v;
        lli cnt=0;
        for(auto it : s)
        {
            if(mm[it]>=4)
            {
                forz(i, mm[it]-mm[it]%4)
                v.pb(it);

                cnt += mm[it]/4;

                mm[it] = mm[it]%4;
            }
        }

        deb(v);
        deb(mm[1]);

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO");
            return ;
        }

        lli curr=0;
        forz(i, vec.si)
        {
            arr[vec[i].fi][vec[i].se] = v[curr];
            curr++;
        }

        for(auto it : s)
        {
            if(mm[it]!=0)
            {
                forz(i, mm[it])
                v.pb(it);
            }
        }

        vl rem;
        set <lli> remset;
        mll remmap;
        for(lli i=curr; i<v.si; i++)
        {
            rem.pb(v[i]);
            remset.in(v[i]);
            remmap[v[i]]++;
        }

        deb(rem);

        lli oddcnt=0, oddel=-1;
        for(auto it : remset)
        {
            if(remmap[it]%2 == 1)
            {
                oddcnt++;
                oddel = it;
            }
        }

        if(oddcnt != 1)
        {
            p1("NO");
            return ;
        }

        arr[n/2][n/2] = oddel;
        {
            remmap[oddel]--;
            if(remmap[oddel]==0)
            remset.erase(oddel);
        }

        deb(remset);

        i=n/2; j=0;
        for(auto it : remset)
        {
            deb(it);
            bool bo=false;
            while(remmap[it]!=0)
            {
                arr[i][j] = arr[i][n-1-j] = it;
                remmap[it]-=2;

                j++;

                if(j==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }

        i=0; j=n/2;
        for(auto it : remset)
        {
            bool bo=false;
            while(remmap[it]!=0)
            {
                arr[i][j] = arr[n-1-i][j] = it;
                remmap[it]-=2;

                i++;

                if(i==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }
    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    if(n==1)
    {
        p1("YES");
        p1(*s.be);
        return ;
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        lli i=0, j=0;
        vll vec;

        deb(n/2-1);
        while(1)
        {
            // deb(i, j);
            vec.pb(mp(i, j));
            vec.pb(mp(i, n-1-j));
            vec.pb(mp(n-1-i, j));
            vec.pb(mp(n-1-i, n-1-j));

            if(i==n/2-1 && j==n/2-1)
            break;

            if(j == n/2-1)
            {
                i++;
                j=0;
            }

            else
            j++;
        }

        vl v;
        lli cnt=0;
        for(auto it : s)
        {
            if(mm[it]%4==0)
            {
                forz(i, mm[it])
                v.pb(it);

                cnt += mm[it]/4;
            }
        }

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO");
            return ;
        }

        lli curr=0;
        forz(i, vec.si)
        {
            arr[vec[i].fi][vec[i].se] = v[curr];
            mm[v[curr]]--;
            curr++;
        }

        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                forz(i, mm[it])
                v.pb(it);
            }
        }

        vl rem;
        set <lli> remset;
        mll remmap;
        for(lli i=curr; i<v.si; i++)
        {
            rem.pb(v[i]);
            remset.in(v[i]);
            remmap[v[i]]++;
        }

        lli oddcnt=0, oddel=-1;
        for(auto it : remset)
        {
            if(remmap[it]%2 == 1)
            {
                oddcnt++;
                oddel = it;
            }
        }

        if(oddcnt != 1)
        {
            p1("NO");
            return ;
        }

        arr[n/2][n/2] = oddel;
        {
            remmap[oddel]--;
            if(remmap[oddel]==0)
            remset.erase(oddel);
        }

        deb(remset);

        i=n/2; j=0;
        for(auto it : remset)
        {
            deb(it);
            bool bo=false;
            while(remmap[it]!=0)
            {
                arr[i][j] = arr[i][n-1-j] = it;
                remmap[it]-=2;

                j++;

                if(j==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }

        i=0; j=n/2;
        for(auto it : remset)
        {
            bool bo=false;
            while(remmap[it]!=0)
            {
                arr[i][j] = arr[n-1-i][j] = it;
                remmap[it]-=2;

                i++;

                if(i==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }
    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    // for(auto it : mm)
    // p2(it.fi, it.se);

    if(n==1)
    {
        p1("YES");
        p1(*s.be);
        return ;
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        lli i=0, j=0;
        vll vec;

        deb(n/2-1);
        while(1)
        {
            // deb(i, j);
            vec.pb(mp(i, j));
            vec.pb(mp(i, n-1-j));
            vec.pb(mp(n-1-i, j));
            vec.pb(mp(n-1-i, n-1-j));

            if(i==n/2-1 && j==n/2-1)
            break;

            if(j == n/2-1)
            {
                i++;
                j=0;
            }

            else
            j++;
        }

        vl v;
        lli cnt=0;
        for(auto it : s)
        {
            if(mm[it]>=4)
            {
                forz(i, mm[it]-mm[it]%4)
                v.pb(it);

                cnt += mm[it]/4;
            }
        }

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO0");
            return ;
        }

        lli curr=0;
        forz(i, vec.si)
        {
            arr[vec[i].fi][vec[i].se] = v[curr];
            mm[v[curr]]--;
            curr++;
        }

        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                forz(i, mm[it])
                v.pb(it);
            }
        }

        vl rem;
        set <lli> remset;
        mll remmap;
        for(lli i=curr; i<v.si; i++)
        {
            rem.pb(v[i]);
            remset.in(v[i]);
            remmap[v[i]]++;
        }

        lli oddcnt=0, oddel=-1;
        for(auto it : remset)
        {
            if(remmap[it]%2 == 1)
            {
                oddcnt++;
                oddel = it;
            }
        }

        if(oddcnt != 1)
        {
            p1("NO");
            return ;
        }

        arr[n/2][n/2] = oddel;
        {
            remmap[oddel]--;
            if(remmap[oddel]==0)
            remset.erase(oddel);
        }

        deb(remset);

        i=n/2; j=0;
        for(auto it : remset)
        {
            deb(it);
            bool bo=false;
            while(remmap[it]!=0)
            {
                arr[i][j] = arr[i][n-1-j] = it;
                remmap[it]-=2;

                j++;

                if(j==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }

        i=0; j=n/2;
        for(auto it : remset)
        {
            bool bo=false;
            while(remmap[it]!=0)
            {
                arr[i][j] = arr[n-1-i][j] = it;
                remmap[it]-=2;

                i++;

                if(i==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }
    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    if(n==1)
    {
        p1("YES");
        p1(*s.be);
        return ;
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        lli i=0, j=0;
        vll vec;

        deb(n/2-1);
        while(1)
        {
            // deb(i, j);
            vec.pb(mp(i, j));
            vec.pb(mp(i, n-1-j));
            vec.pb(mp(n-1-i, j));
            vec.pb(mp(n-1-i, n-1-j));

            if(i==n/2-1 && j==n/2-1)
            break;

            if(j == n/2-1)
            {
                i++;
                j=0;
            }

            else
            j++;
        }

        // forz(i, vec.si)
        // p2(vec[i].fi, vec[i].se);

        vl v;
        lli cnt=0;
        for(auto it : s)
        {
            if(mm[it]%4==0)
            {
                forz(i, mm[it])
                v.pb(it);

                cnt += mm[it]/4;
            }
        }

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO");
            return ;
        }

        lli curr=0;
        forz(i, vec.si)
        {
            arr[vec[i].fi][vec[i].se] = v[curr];
            curr++;
        }

        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                forz(i, mm[it])
                v.pb(it);
            }
        }

        vll uni;
        forz(i, n)
        uni.pb(mp(n/2, i));

        forz(i, n)
        if(i!=n/2)
        uni.pb(mp(i, n/2));

        forz(i, uni.si)
        {
            arr[uni[i].fi][uni[i].se] = v[curr];
            curr++;
        }

    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        set <lli> special;
        lli cnt = 0;
        for(auto it : s)
        {
            if(mm[it]%4 != 0)
            {
                special.in(it);
            }

            else
            cnt += mm[it]/4;
        }

        for(auto it : special)
        s.erase(it);

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO");
            return ;
        }

        lli i=0, j=0;
        vl del;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
                if(mm[curr]==0)
                del.pb(curr);
            }
        }

        for(auto it : del)
        s.erase(it);

        for(auto it : s)
        {
            special.in(it);
        }

        vl rem;
        for(auto it : special)
        {
            forz(j, mm[it])
            rem.pb(it);
        }

        forz(i, n)
        arr[n/2][i] = rem[i];

        forz(i, n)
        {
            if(i!=n/2)
            arr[i][n/2] = rem[i+n-1];
        }
    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    if(n==1)
    {
        p1("YES");
        p1(*s.be);
        return ;
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        lli i=0, j=0;
        vll vec;

        deb(n/2-1);
        while(1)
        {
            // deb(i, j);
            vec.pb(mp(i, j));
            vec.pb(mp(i, n-1-j));
            vec.pb(mp(n-1-i, j));
            vec.pb(mp(n-1-i, n-1-j));

            if(i==n/2-1 && j==n/2-1)
            break;

            if(j == n/2-1)
            {
                i++;
                j=0;
            }

            else
            j++;
        }

        vl v;
        lli cnt=0;
        for(auto it : s)
        {
            if(mm[it]%4==0)
            {
                forz(i, mm[it])
                v.pb(it);

                cnt += mm[it]/4;
            }
        }

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO");
            return ;
        }

        lli curr=0;
        forz(i, vec.si)
        {
            arr[vec[i].fi][vec[i].se] = v[curr];
            mm[v[curr]]--;
            curr++;
        }

        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                forz(i, mm[it])
                v.pb(it);
            }
        }

        vl rem;
        set <lli> remset;
        mll remmap;
        for(lli i=curr; i<v.si; i++)
        {
            rem.pb(v[i]);
            remset.in(v[i]);
            remmap[v[i]]++;
        }

        lli oddcnt=0, oddel=-1;
        for(auto it : remset)
        {
            if(mm[it]%2 == 1)
            {
                oddcnt++;
                oddel = it;
            }
        }

        if(oddcnt != 1)
        {
            p1("NO");
            return ;
        }

        arr[n/2][n/2] = oddel;
        {
            mm[oddel]--;
            if(mm[oddel]==0)
            remset.erase(oddel);
        }

        deb(remset);

        i=n/2; j=0;
        for(auto it : remset)
        {
            deb(it);
            bool bo=false;
            while(mm[it]!=0)
            {
                arr[i][j] = arr[i][n-1-j] = it;
                mm[it]-=2;

                j++;

                if(j==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }

        i=0; j=n/2;
        for(auto it : remset)
        {
            bool bo=false;
            while(mm[it]!=0)
            {
                arr[i][j] = arr[n-1-i][j] = it;
                mm[it]-=2;

                i++;

                if(i==n/2)
                {
                    bo = true;
                    break;
                }
            }

            if(bo) break;
        }
    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


/**
 *    Author:   ElProfesor._.
 *
**/

#include<bits/stdc++.h>

using namespace std;

// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef pair <lli,lli> pll;
typedef pair <lli,string> pls;
typedef pair <lli,lli> pll;

typedef vector <lli> vl;
typedef vector <pll> vll;
typedef vector <string> vs;
typedef vector <char> vc;

typedef map <lli, lli> mll;
typedef map <pll, lli> mpll;
typedef map <string, lli> msl;

typedef priority_queue <lli> max_heap ;
typedef priority_queue < lli, vector<lli> , greater<lli> > min_heap;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define pb push_back
#define pf push_front
#define in insert
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define lb lower_bound
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define maxe *max_element
#define mine *min_element
#define deb debug
#define all(v) v.be, v.en

#define forz(i, n) for (int i = 0; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)

#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;

#define p1(i) cout<<i<<endl
#define p2(i, j) cout<<i<<" "<<j<<endl
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl

// Exponentiation in O(log y)
lli power(lli x,lli y){lli res=1; x=x;while(y>0){if(y&1) res=(res*x);y=y>>1;x=(x*x);}return res;}

// Modular Exponentiation in O(log y)
lli power(lli x,lli y,lli p){lli res=1; x=x%p;while(y>0){if(y&1) res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

// Euclidean gcd
lli gcd(lli a, lli b) { if (a==0) return b; return gcd(b % a, a);}

// CODE BEGINS :
void solve()
{
    lli n; cin>>n;

    mll mm;
    set <lli>s;
    forz(i, n*n)
    {
        lli t; cin>>t;
        mm[t]++;
        s.in(t);
    }

    lli arr[n][n];
    forz(i, n)
    {
        forz(j, n)
        {
            arr[i][j]=0;
        }
    }

    if(n%2 == 1)
    {
        set <lli> special;
        lli cnt = 0;
        for(auto it : s)
        {
            if(mm[it]%4 != 0)
            {
                special.in(it);
            }

            else
            cnt += mm[it]/4;
        }

        for(auto it : special)
        s.erase(it);

        lli req = (n/2)*(n/2);
        if(cnt < req)
        {
            p1("NO");
            return ;
        }

        lli i=0, j=0;
        vl del;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
                if(mm[curr]==0)
                del.pb(curr);
            }
        }

        for(auto it : del)
        s.erase(it);

        for(auto it : s)
        {
            special.in(it);
        }

        vl rem;
        for(auto it : special)
        {
            forz(j, mm[it])
            rem.pb(it);
        }

        forz(i, n)
        arr[n/2][i] = rem[i];

        forz(i, n)
        {
            if(i!=n/2)
            arr[i][n/2] = rem[i+n-1];
        }
    }

    if(n%2 == 0)
    {
        for(auto it : s)
        {
            if(mm[it]%4!=0)
            {
                p1("NO");
                return ;
            }
        }

        lli i=0, j=0;
        for(auto it : s)
        {
            while(mm[it] != 0)
            {
                lli curr = it;
                arr[i][j] = curr;
                arr[i][n-1-j] = curr;
                arr[n-1-i][j] = curr;
                arr[n-1-i][n-1-j] = curr;

                if(j == n/2-1)
                {
                    i++;
                    j=0;
                }

                else
                j++;

                mm[curr] -= 4;
            }
        }
    }

    p1("YES");
    forz(i, n)
    {
        forz(j, n)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    lli t=1; // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x,mx=-9;
vector<ll>v,c,tmp;
map<ll,ll>m;
map<ll,ll>::iterator it;

set<ll>s;
ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(s.size()==1){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;
        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        mx=max(mx,x);
        m[x]++;
        s.insert(x);
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
     v=vector<ll>(s.begin() ,s.end());
    ///for(auto ip:v) cout<<ip<<" .,"; eee;
     if(n==1 || n==2) ret spcase(),0;
    /// c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] ) ; i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size() ) == lmt*lmt ) break;
    }

   /// cout<<" XCZ "<<c.size()<<endl;
    if((c.size() ) < lmt*lmt ) { cout<<"NO\n";
            ret 0;}
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size() ; i++)
        {
              cur=c.back(), c.pop_back(); //tmp.pop_back() ;
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
        ///cout<<"HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH";
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               //cout<<v[i]<<" |_--_| "<<m[v[i] ]<<endl;
               tmp.pb(v[i]);
               i=0;
           }
           if(tmp.size()*2 == n-1) break;
        }
        /////cout<<"XXXXXXX  "<<tmp.size()<<endl;;
        ///for(auto iy:tmp) cout<<iy<<" XX4";
        if(tmp.size()*2 < n-1) {cout<<"NO\n";
            ret 0;}
        for(ll i=1; i<=lmt and tmp.size()  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }
        tmp.clear();
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               //cout<<v[i]<<" |_--_| "<<m[v[i] ]<<endl;
               tmp.pb(v[i]);
               i=0;
           }
           if(tmp.size()*2 == n-1) break;
        }
        //cout<<tmp.size()<<" SIZZZZ \n";
        if(tmp.size()*2 < n-1) {cout<<"NO\n";
            ret 0;}
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]==1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0 )
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
           if(ans[i][j]==-1 || ans[i][j]>mx)
           {
               cout<<"NO\n";
            ret 0;
           }
        }

    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x,mx=-9;
vector<ll>v,c,tmp;
map<ll,ll>m;
map<ll,ll>::iterator it;

set<ll>s;
ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(s.size()==1){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;
        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        mx=max(mx,x);
        m[x]++;
        s.insert(x);
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
     v=vector<ll>(s.begin() ,s.end());
    ///for(auto ip:v) cout<<ip<<" .,"; eee;
     if(n==1 || n==2) ret spcase(),0;
    /// c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] ) ; i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size() ) == lmt*lmt ) break;
    }

   /// cout<<" XCZ "<<c.size()<<endl;
    if((c.size() ) < lmt*lmt ) { cout<<"NO\n";
            ret 0;}
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size() ; i++)
        {
              cur=c.back(), c.pop_back(); //tmp.pop_back() ;
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
        ///cout<<"HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH";
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               //cout<<v[i]<<" |_--_| "<<m[v[i] ]<<endl;
               tmp.pb(v[i]);
               i=0;
           }
           if(tmp.size()*2 == n-1) break;
        }
        /////cout<<"XXXXXXX  "<<tmp.size()<<endl;;
        ///for(auto iy:tmp) cout<<iy<<" XX4";
        if(tmp.size()*2 < n-1) {cout<<"NO\n";
            ret 0;}
        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               //cout<<v[i]<<" |_--_| "<<m[v[i] ]<<endl;
               tmp.pb(v[i]);
               i=0;
           }
           if(tmp.size()*2 == n-1) break;
        }
        //cout<<tmp.size()<<" SIZZZZ \n";
        if(tmp.size()*2 < n-1) {cout<<"NO\n";
            ret 0;}
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]==1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0 || sps.size()>1 )
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
//    loopeq(i,1,n)
//    {
//        loopeq(j,1,n)
//        {
//           if(ans[i][j]==-1 || ans[i][j]>mx)
//           {
//               cout<<"NO\n";
//            ret 0;
//           }
//        }
//
//    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x,mx=-9;
vector<ll>v,c,tmp;
map<ll,ll>m;
map<ll,ll>::iterator it;

set<ll>s;
ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        if(s.size()==1){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;
        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        mx=max(mx,x);
        m[x]++;
        s.insert(x);
    }
    lmt=n/2;
    sort(v.begin(),v.end());
     v=vector<ll>(s.begin() ,s.end());
     if(n==1 || n==2) ret spcase(),0;
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] ) ; i=-1; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size() ) == lmt*lmt ) break;
    }
    if((c.size() ) < lmt*lmt ) { cout<<"NO\n";
            ret 0;}
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        for(ll i=1 ;c.size() ; i++)
        {
              cur=c.back(), c.pop_back(); //tmp.pop_back() ;
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=-1;
           }
           if(tmp.size()*2 == n-1) break;
        }
        if(tmp.size()*2 < n-1) {cout<<"NO\n";
            ret 0;}
        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               //cout<<v[i]<<" |_--_| "<<m[v[i] ]<<endl;
               tmp.pb(v[i]);
               i=-1;
           }
           if(tmp.size()*2 == n-1) break;
        }
        //cout<<tmp.size()<<" SIZZZZ \n";
        if(tmp.size()*2 < n-1) {cout<<"NO\n";
            ret 0;}
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]==1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0 || sps.size()>1 )
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;
    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x,mx=-9;
vector<ll>v,c;
map<ll,ll>m;
map<ll,ll>::iterator it;

ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(v[0]==v[3]){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;

        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        mx=max(mx,x);
        m[x]++;
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
    auto ip=unique(v.begin() ,v.end() );
    v.resize(  distance(v.begin() , ip) );

    ///for(auto ip:v) cout<<ip<<" .,"; eee;

     if(n==1 || n==2) ret spcase(),0;
     c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] );  i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size()  -1) ==lmt*lmt ) break;
    }
//     cout<<" \n::::::::: "<<c.size()<<" elements: ";
//    for(auto it2:c) cout<<it2<<" ";
//    eee;
    if( (c.size()  -1) !=lmt*lmt)   {cout<<"NO\n"; ret 0; }
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size()>1 ; i++)
        {
              cur=c.back(); c.pop_back();
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
        /////////////////////////////////
//        loopeq(i,1,n)
//        {
//            loopeq(j,1,n)
//            {
//                cout<<ans[i][j]<<" ";
//            }
//            eee;
//
//        }
    ////////////////////////////////////
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        vector<ll>tmp;
        ///tmp=c;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
        }
//        if(  2*tmp.size()+1 !=n )
//        {
//            cout<<"NO\n";
//            ret 0;
//        }
        ///cout<<tmp.size()<<" TMP "<<endl;
        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }

        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
        }
//        if(  2*tmp.size()+1 !=n )
//        {
//            cout<<"NO\n";
//            ret 0;
//        }
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0)
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
           if(ans[i][j]<1 || ans[i][j]>mx)
           {
               cout<<"NO\n";
            ret 0;
           }
        }
        ///eee;

    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x;
vector<ll>v,c;
map<ll,ll>m;
map<ll,ll>::iterator it;

ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(v[0]==v[3]){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;

        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        m[x]++;
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
    auto ip=unique(v.begin() ,v.end() );
    v.resize(  distance(v.begin() , ip) );

    ///for(auto ip:v) cout<<ip<<" .,"; eee;

     if(n==1 || n==2) ret spcase(),0;
     c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] );  i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size()  -1) ==lmt*lmt ) break;
    }
//     cout<<" \n::::::::: "<<c.size()<<" elements: ";
//    for(auto it2:c) cout<<it2<<" ";
//    eee;
    if( (c.size()  -1) !=lmt*lmt)   {cout<<"NO\n"; ret 0; }
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size()>1 ; i++)
        {
              cur=c.back(); c.pop_back();
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }

        /////////////////////////////////
//        loopeq(i,1,n)
//        {
//            loopeq(j,1,n)
//            {
//                cout<<ans[i][j]<<" ";
//            }
//            eee;
//
//        }
    ////////////////////////////////////
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        vector<ll>tmp;
        ///tmp=c;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
           }
        }
//        if(  2*tmp.size()+1 !=n )
//        {
//            cout<<"NO\n";
//            ret 0;
//        }
        ///cout<<tmp.size()<<" TMP "<<endl;
        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }

        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
           }
        }
//        if(  2*tmp.size()+1 !=n )
//        {
//            cout<<"NO\n";
//            ret 0;
//        }
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0)
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
           if(ans[i][j]<1)
           {
               cout<<"NO\n";
            ret 0;
           }
        }
        ///eee;

    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x,mx=-9;
vector<ll>v,c;
map<ll,ll>m;
map<ll,ll>::iterator it;

ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(v[0]==v[3]){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;

        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        mx=max(mx,x);
        m[x]++;
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
    auto ip=unique(v.begin() ,v.end() );
    v.resize(  distance(v.begin() , ip) );

    ///for(auto ip:v) cout<<ip<<" .,"; eee;

     if(n==1 || n==2) ret spcase(),0;
    /// c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] );  i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size() ) ==lmt*lmt ) break;
    }
//     cout<<" \n::::::::: "<<c.size()<<" elements: ";
//    for(auto it2:c) cout<<it2<<" ";
//    eee;
    if( (c.size() ) !=lmt*lmt)   {cout<<"NO\n"; ret 0; }
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size() ; i++)
        {
              cur=c.back(); c.pop_back();
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        vector<ll>tmp;
        ///tmp=c;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
          if((2*tmp.size() +1 ) ==n ) break;
        }
        ///cout<<tmp.size()<<" TMP "<<endl;
        if((2*tmp.size() +1 ) !=n  )   {cout<<"NO\n"; ret 0; }

        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }
        tmp.clear() ;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
         if((2*tmp.size() +1 ) ==n ) break;

        }
        if((2*tmp.size() +1 ) !=n  )   {cout<<"NO\n"; ret 0; }
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]==1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0 )
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
//    loopeq(i,1,n)
//    {
//        loopeq(j,1,n)
//        {
//           if(ans[i][j]==-1 || ans[i][j]>mx)
//           {
//               cout<<"NO\n";
//            ret 0;
//           }
//        }
//
//    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x;
vector<ll>v,c;
map<ll,ll>m;
map<ll,ll>::iterator it;

ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(v[0]==v[3]){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;

        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        m[x]++;
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
    auto ip=unique(v.begin() ,v.end() );
    v.resize(  distance(v.begin() , ip) );

    ///for(auto ip:v) cout<<ip<<" .,"; eee;

     if(n==1 || n==2) ret spcase(),0;
     c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] );  i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size()  -1) ==lmt*lmt ) break;
    }
//     cout<<" \n::::::::: "<<c.size()<<" elements: ";
//    for(auto it2:c) cout<<it2<<" ";
//    eee;
    if( (c.size()  -1) !=lmt*lmt)   {cout<<"NO\n"; ret 0; }
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size()>1 ; i++)
        {
              cur=c.back(); c.pop_back();
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        vector<ll>tmp;
        ///tmp=c;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
           }
        }
        if(  2*tmp.size()+1 !=n )
        {
            cout<<"NO\n";
            ret 0;
        }
        ///cout<<tmp.size()<<" TMP "<<endl;
        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }

        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
           }
        }
        if(  2*tmp.size()+1 !=n )
        {
            cout<<"NO\n";
            ret 0;
        }
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]==1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0)
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x,mx=-9;
vector<ll>v,c;
map<ll,ll>m;
map<ll,ll>::iterator it;

ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(v[0]==v[3]){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;

        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        mx=max(mx,x);
        m[x]++;
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
    auto ip=unique(v.begin() ,v.end() );
    v.resize(  distance(v.begin() , ip) );

    ///for(auto ip:v) cout<<ip<<" .,"; eee;

     if(n==1 || n==2) ret spcase(),0;
    /// c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] );  i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size() ) ==lmt*lmt ) break;
    }
//     cout<<" \n::::::::: "<<c.size()<<" elements: ";
//    for(auto it2:c) cout<<it2<<" ";
//    eee;
    if( (c.size() ) !=lmt*lmt)   {cout<<"NO\n"; ret 0; }
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size() ; i++)
        {
              cur=c.back(); c.pop_back();
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        vector<ll>tmp;
        ///tmp=c;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
          if((2*tmp.size()  ) ==n-1 ) break;
        }
        ///cout<<tmp.size()<<" TMP "<<endl;
        if((2*tmp.size()  ) !=n-1  )   {cout<<"NO\n"; ret 0; }

        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }
        tmp.clear() ;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
         if((2*tmp.size()  ) ==n-1 ) break;

        }
        if((2*tmp.size()  ) !=n-1  )   {cout<<"NO\n"; ret 0; }
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0 )
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
//    loopeq(i,1,n)
//    {
//        loopeq(j,1,n)
//        {
//           if(ans[i][j]==-1 || ans[i][j]>mx)
//           {
//               cout<<"NO\n";
//            ret 0;
//           }
//        }
//
//    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x;
vector<ll>v,c;
map<ll,ll>m;
map<ll,ll>::iterator it;

ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(v[0]==v[3]){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;

        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        m[x]++;
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
    auto ip=unique(v.begin() ,v.end() );
    v.resize(  distance(v.begin() , ip) );

    ///for(auto ip:v) cout<<ip<<" .,"; eee;

     if(n==1 || n==2) ret spcase(),0;
     c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] );  i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size()  -1) ==lmt*lmt ) break;
    }
//     cout<<" \n::::::::: "<<c.size()<<" elements: ";
//    for(auto it2:c) cout<<it2<<" ";
//    eee;
    if( (c.size()  -1) !=lmt*lmt)   {cout<<"NO\n"; ret 0; }
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size()>1 ; i++)
        {
              cur=c.back(); c.pop_back();
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        vector<ll>tmp;
        ///tmp=c;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
           }
        }
        if(  2*tmp.size()+1 !=n )
        {
            cout<<"NO\n";
            ret 0;
        }
        ///cout<<tmp.size()<<" TMP "<<endl;
        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }

        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
           }
        }
        if(  2*tmp.size()+1 !=n )
        {
            cout<<"NO\n";
            ret 0;
        }
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]==1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0)
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,u) for(int i=(int)l ; i<(int)u  ; i++)
#define  loopeq(i,L,U)    for(long long int i=(long long int)L;i<=U;i++)
#define pb push_back
#define ret return
#define sc second
#define fs first

#define eee cout<<endl;
ll n,lmt,x,mx=-9;
vector<ll>v,c;
map<ll,ll>m;
map<ll,ll>::iterator it;

set<ll>s;
ll ans[23][23];
ll spcase()
{
     if(n==1)
    {
        ret cout<<"YES\n"<<v[0]<<endl,0;
    }
    if(n==2)
    {
        sort(v.begin(),v.end() );
        if(v[0]==v[3]){
                cout<<"YES\n"<<v[0]<<" "<<v[0]<<"\n"<<v[0]<<" "<<v[0];
                ret 0;

        }
        else cout<<"NO\n";
    }
}
int main()
{
    cin>>n;
    memset(ans,-1,sizeof ans);
    loop(i,0,n*n)
    {
        cin>>x;
        v.pb(x);
        mx=max(mx,x);
        m[x]++;
        s.insert(x);
        ///cout<<"x= "<<x<<" m[x]= "<<m[x]<<endl;
    }
    lmt=n/2;
    sort(v.begin(),v.end());
     v=vector<ll>(s.begin() ,s.end());
    ///for(auto ip:v) cout<<ip<<" .,"; eee;

     if(n==1 || n==2) ret spcase(),0;
    /// c.pb(-1);
    for(ll i=0 ; i<v.size() ; i++)
    {
        if( m[ v[i] ] >=4) {  m[ v[i] ] = m[ v[i] ] -4  ; c.pb( v[i] );  i=0; /*cout<<c.back()<<"<-Insertd "; */  }
        if((c.size() ) ==lmt*lmt ) break;
    }
    {
        ll ex=0,ccc=0,r=1,tr=1,cur;
        ///reverse(  c.begin() , c.end() );c.pop_back() ; size tik koro;
        for(ll i=1 ;c.size() ; i++)
        {
              cur=c.back(), c.pop_back();
              if( i%(lmt+1)==0 ) {r++; i=1 ; }
              ans[r][i]= ans[r][n-i+1]=cur;
              ans[n-r+1][i] = ans[n-r+1] [  n-i+1] =cur;
        }
    }
    vector<ll>sps;
    if(n%2)
    {
        ll r=lmt+1 , col=lmt+1;
        vector<ll>tmp;
        ///tmp=c;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
          if((2*tmp.size()  ) ==n-1 ) break;
        }
        ///cout<<tmp.size()<<" TMP "<<endl;
        if((2*tmp.size()  ) !=n-1  )   {cout<<"NO\n"; ret 0; }

        for(ll i=1; i<=lmt  ; i++)
        {
            ans[r][i]= ans[r][n-i+1]=tmp.back();
            tmp.pop_back() ;
        }
        tmp.clear() ;
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=2 )
           {
               m[ v[i] ] =m[ v[i ] ]-2;
               tmp.pb(v[i]);
               i=0;
           }
         if((2*tmp.size()  ) ==n-1 ) break;

        }
        if((2*tmp.size()  ) !=n-1  )   {cout<<"NO\n"; ret 0; }
        for(ll i=1; i<=lmt ; i++)
        {
            ans[i][col]= ans[ n-i+1 ][  col ]=tmp.back();
            tmp.pop_back() ;
        }
        for(ll i=0 ; i<v.size() ; i++)
        {
           if( m[ v[i]  ]>=1 )
           {
               sps.pb(v[i]);
           }
        }
        if(sps.size()==0 )
        {
            cout<<"NO\n";
            ret 0;
        }
        ans[lmt+1][lmt+1]=sps.back() ;
    }
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
           if(ans[i][j]==-1 || ans[i][j]>mx)
           {
               cout<<"NO\n";
            ret 0;
           }
        }

    }
    cout<<"YES\n";
    loopeq(i,1,n)
    {
        loopeq(j,1,n)
        {
            cout<<ans[i][j]<<" ";
        }
        eee;

    }

}
/*
7
5 9 5 4 1 9 8 4 5 1 4 10 7 7 8 4 2 4 4 5 4 4 10 3 4 6 8 1 9 9 5 6 8 7 1 8 6 6 7 5 3 1 1 4 7 2 3 3 8
*/