import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // your code goes here int[][] board = new int[n][n]; int[][] nmove = new int[n-1][n-1]; for (int a = 1; a < n; ++a) { for (int b = a; b < n; ++b) { nmove[a-1][b-1] = -1; nmove[b-1][a-1] = -1; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { board[i][j] = -1; } } board[0][0] = 0; Queue queue = new LinkedList(); int[] position = {0, 0}; queue.add(position); while (!queue.isEmpty()) { position = queue.poll(); int[] delta_x = {a, -a, b, -b, a, -b, -a, b}; int[] delta_y = {b, -b, a, -a, -b, a, b, -a}; for (int i = 0; i < delta_x.length; ++i) { if ((position[0] + delta_x[i] < n) && (position[1] + delta_y[i] < n) && (position[0] + delta_x[i] >= 0) && (position[1] + delta_y[i] >= 0)) { if (board[position[0] + delta_x[i]][position[1] + delta_y[i]] == -1) { board[position[0] + delta_x[i]][position[1] + delta_y[i]] = board[position[0]][position[1]] + 1; int[] temp = new int[2]; temp[0] = position[0] + delta_x[i]; temp[1] = position[1] + delta_y[i]; queue.add(temp); } } } if (board[n-1][n-1] != -1) { nmove[a-1][b-1] = board[n-1][n-1]; break; } } if (a != b) { nmove[b-1][a-1] = nmove[a-1][b-1]; } } } for (int a = 0; a < n-1; ++a) { for (int b = 0; b < n-1; ++b) { System.out.print(nmove[a][b] + " "); } System.out.println(); } } }