#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<vector<int> > v(n, vector<int>(n, 0));
    int cnt = 1;
    for(int i=0; i<n; ++i){
        for(int y=0; y<n/2; ++y){
            int x = i - y;
            if(0 <= x && x < n / 2){
                v[y+n/2][x+n/2] = cnt;
                ++ cnt;
                v[y][x] = cnt;
                ++ cnt;
            }
        }
    }
    for(int i=0; i<n; ++i){
        for(int y=0; y<n/2; ++y){
            int x = n - 1 - i + y;
            if(n / 2 <= x && x < n){
                v[y][x] = cnt;
                ++ cnt;
                v[y+n/2][x-n/2] = cnt;
                ++ cnt;
            }
        }
    }

    for(int y=0; y<n; ++y){
        cout << v[y][0];
        for(int x=1; x<n; ++x)
            cout << ' ' << v[y][x];
        cout << endl;
    }

    return 0;
}