#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#include <Windows.h>
#endif

int main()
{
    int n, i = 0, j = 0;
    cin >> n;
    int rt = n, lt = -1, up = 0, lo = n, cnt = 1;
    vector<vector<int>> v(n, vector<int>(n, 0));
    while (i != n/2 && j != n/2 && v[i][j] == 0){
        while (rt != j && v[i][j] == 0){
            v[i][j] = cnt;
            cnt++;
            j++;
        }
        rt--;
        j--;
        i++;
        while (lo != i && v[i][j] == 0){
            v[i][j] = cnt;
            cnt++;
            i++;
        }
        lo--;
        i--;
        j--;
        while (lt != j && v[i][j] == 0){
            v[i][j] = cnt;
            cnt++;
            j--;
        }
        lt++;
        j++;
        i--;
        while (up != i && v[i][j] == 0){
            v[i][j] = cnt;
            cnt++;
            i--;
        }
        lo++;
        i++;
        j++;
    }
    if (v[i][j] == 0) v[i][j] = cnt;
    cnt = 1;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            printf("%03d", v[i][j]);
            if (!((j+1)%n)) cout << endl;
            else cout << " ";
        }
    }
}