func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = (int)555;   const int mod = (int)1e9 + 7;   const int P = (int)1e6 + 7;   const double pi = acos(-1.0);   int a[maxn][maxn], b[maxn][maxn], n;   vector<vector<int> > base{{1, 2, 4}, {5, 3, 8}, {9, 6, 7}};   void rec(int n) {     if (n == 3) {       for (int i = (0); i <= (n - 1); ++i)         for (int j = (0); j <= (n - 1); ++j) a[i][j] = base[i][j];       return;     }     rec(n - 1);     if (!(n & 1)) {       int cur = 1;       for (int i = (n - 1); i >= (1); --i) b[i][n - 1] = cur++;       for (int i = (n - 1); i >= (0); --i) b[0][i] = cur++;       for (int i = (1); i <= (n - 1); ++i)         for (int j = (0); j <= (n - 2); ++j) b[i][j] = cur + a[i - 1][j] - 1;     } else {       int cur = 1;       for (int i = (0); i <= (n - 1); ++i) b[0][i] = cur++;       for (int i = (1); i <= (n - 1); ++i) b[i][n - 1] = cur++;       for (int i = (1); i <= (n - 1); ++i)         for (int j = (0); j <= (n - 2); ++j) b[i][j] = cur + a[i - 1][j] - 1;     }     for (int i = (0); i <= (n - 1); ++i)       for (int j = (0); j <= (n - 1); ++j) a[i][j] = b[i][j];   }   void solve() {     scanf( %d , &n);     if (n <= 2) {       puts( -1 );       return;     }     rec(n);     for (int i = (0); i <= (n - 1); ++i) {       for (int j = (0); j <= (n - 1); ++j) printf( %d  , a[i][j]);       puts(  );     }   }   int main() {     int t = 1;     while (t--) solve();   }   