#include using namespace std; const int N = 30; int n; int c[N][N]; void push(queue> &Q, int x, int y, int val) { if (x < 0 || x >= n || y < 0 || y >= n) return; if (c[x][y] == -1) { Q.push({x, y}); c[x][y] = val + 1; } } int Cal(int a, int b) { queue> Q; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) c[i][j] = -1; Q.push({0, 0}); c[0][0] = 0; while (Q.size()) { int x = Q.front().first, y = Q.front().second; Q.pop(); push(Q, x + a, y + b, c[x][y]); push(Q, x + b, y + a, c[x][y]); push(Q, x + a, y - b, c[x][y]); push(Q, x - b, y + a, c[x][y]); push(Q, x - a, y + b, c[x][y]); push(Q, x + b, y - a, c[x][y]); push(Q, x - a, y - b, c[x][y]); push(Q, x - b, y - a, c[x][y]); } return c[n - 1][n - 1]; } int main() { scanf("%d", &n); for (int i = 1; i < n; i++) { for (int j = 1; j < n; j++) printf("%d ", Cal(i, j)); printf("\n"); } return 0; }