func_code_string: #include <bits/stdc++.h>   using namespace std;   int ans[21][21];   int cnt[1100];   int n;   vector<int> fang, four;   void output() {     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= n; ++j) {         cout << ans[i][j] <<    ;       }       cout << endl;     }   }   bool check() {     int sum = 0;     for (int i = 0; i < fang.size(); ++i) {       if (cnt[fang[i]] >= 4) {         four.push_back(fang[i]);         sum += cnt[fang[i]] / 4;       }     }     return sum >= ((n / 2) * (n / 2));   }   int main() {     int num;     cin >> n;     for (int i = 0; i < n * n; ++i) {       cin >> num;       cnt[num]++;     }     int flag = 1, flag2 = 0, lcqi;     for (int i = 1; i <= 1000; ++i) {       if (cnt[i]) {         fang.push_back(i);         if (cnt[i] % 4) {           flag = 0;         }         if (cnt[i] & 1) flag2++, lcqi = fang.size() - 1;       } else         continue;     }     if ((n & 1) == 0) {       if (flag) {         cout <<  YES n ;         int lc = 0;         for (int i = 1; i <= n / 2; ++i) {           for (int j = 1; j <= n / 2; ++j) {             ans[i][j] = ans[n - i + 1][j] = ans[i][n - j + 1] =                 ans[n - i + 1][n - j + 1] = fang[lc];             cnt[fang[lc]] -= 4;             if (cnt[fang[lc]] == 0) {               lc++;             }           }         }         output();       } else         cout <<  NO n ;     } else {       if (flag2 != 1) {         cout <<  NO n ;         return 0;       }       ans[n / 2 + 1][n / 2 + 1] = fang[lcqi];       cnt[fang[lcqi]]--;       int ok = check();       if (!ok) {         puts( NO n );         return 0;       }       cout <<  YES n ;       int lcf = 0;       for (int i = 1; i <= n / 2; ++i) {         for (int j = 1; j <= n / 2; ++j) {           ans[i][j] = ans[n - i + 1][j] = ans[i][n - j + 1] =               ans[n - i + 1][n - j + 1] = four[lcf];           cnt[four[lcf]] -= 4;           if (cnt[four[lcf]] < 4) {             lcf++;           }         }       }       lcf = 0;       while (lcf < fang.size() && cnt[fang[lcf]] == 0) {         lcf++;       }       for (int i = 1; i <= n / 2; ++i) {         ans[i][n / 2 + 1] = ans[n - i + 1][n / 2 + 1] = fang[lcf];         cnt[fang[lcf]] -= 2;         if (cnt[fang[lcf]] == 0) {           while (lcf < fang.size() && cnt[fang[lcf]] == 0) {             lcf++;           }         }       }       for (int i = 1; i <= n / 2; ++i) {         ans[n / 2 + 1][i] = ans[n / 2 + 1][n - i + 1] = fang[lcf];         cnt[fang[lcf]] -= 2;         if (cnt[fang[lcf]] == 0) {           while (lcf < fang.size() && cnt[fang[lcf]] == 0) {             lcf++;           }         }       }       output();     }     return 0;   }   