func_code_string: #include <bits/stdc++.h>   using namespace std;   int dir[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};   int ans[505][505];   int col = 1, n, coz = 0;   int main() {     std::ios::sync_with_stdio(false);     scanf( %d , &n);     if (n < 3) {       printf( -1 );       return 0;     }     int now_ = 0, cot = n;     int x = 1, y = 0;     int rest = n * n;     while (rest != 9) {       for (int i = 1; i <= cot; i++) {         coz++;         x += dir[now_][0];         y += dir[now_][1];         ans[x][y] = coz;       }       rest -= cot;       col++;       if (col % 2 == 0) cot--;       now_ = (now_ + 1) % 4;     }     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 1;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 2;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 4;     now_ = (now_ + 1) % 4;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 5;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 9;     now_ = (now_ + 1) % 4;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 6;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 7;     now_ = (now_ + 1) % 4;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 8;     now_ = (now_ + 1) % 4;     x += dir[now_][0];     y += dir[now_][1];     ans[x][y] = coz + 3;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) printf( %d  , ans[i][j]);       printf(  n );     }     return 0;   }   