#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <stdio.h>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <queue>
# include <unordered_map>
using namespace std;


#define all(v) (v).begin(),(v).end()
#define sz(a) int((a).size())
#define PB push_back
#define mem(a, b) memset(a, b, sizeof(a))
#define MP make_pair
#define EPS      1e-9
#define oo       1e9
#define OO       1e14*1LL
#define PI       3.141592653589793
#define F        first
#define S        second
#define pw(x)	 (x)*(x)

typedef stringstream ss;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
const int dx[] = { 0, -1, 0, 1, -1, -1, 1, 1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };

int ans[30][30], sp[30][30], n;

struct node {
	int x, y, cost;
	bool operator<(const node &e)const { return cost > e.cost; }
};

bool valid(int x, int y) {
	return x >= 0 && y >= 0 && x < n && y < n;
}

void inf() {
	for (int i = 0; i < n; i++) {
		for (int k = 0; k < n; k++)
			sp[i][k] = oo;
	}
}

int main()
{
	cin >> n; inf();
	for (int a = 1; a < n; a++) {
		for (int b = 1; b < n; b++) {
			int DX[] = { a,a,-a,-a,b,b,-b,-b };
			int DY[] = { b,-b,b,-b,a,-a,a,-a };
			queue<node>q; q.push({ 0,0,0 }); sp[0][0] = 0;
			while (!q.empty()) {
				int x = q.front().x, y = q.front().y, c = q.front().cost; q.pop();
				for (int i = 0; i < 8; i++) {
					int nx = x + DX[i], ny = y + DY[i];
					if (valid(nx, ny)) {
						if (c + 1 < sp[nx][ny]) {
							sp[nx][ny] = c + 1;
							q.push({ nx, ny, c + 1 });
						}
					}
				}
			}
			ans[a][b] = sp[n - 1][n - 1];
			inf();
		}
	}
	for (int i = 1; i < n; i++) {
		for (int k = 1; k < n; k++) {
			if (ans[i][k] == oo)
				ans[i][k] = -1;
		}
	}
	for (int i = 1; i < n; i++) {
		for (int k = 1; k < n; k++) {
			cout << ans[i][k] << " ";
		}
		cout << endl;
	}
	return 0;
}