import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static int[][] DIR = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}}; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[][] ret = new int[n + 1][n + 1]; for (int i = 1; i < n; i++) { StringBuilder sb = new StringBuilder(); for (int j = 1; j < n; j++) { if (ret[i][j] == 0) { int[][] board = new int[n][n]; board[0][0] = 1; solve(board, i, j); //System.out.print("(" + board[n - 1][n - 1] + ")"); if (board[n - 1][n - 1] == 0) board[n - 1][n - 1] = -1; ret[i][j] = ret[j][i] = board[n - 1][n - 1]; } //sb.append(i + ", " + j + ": " + ret[i][j]).append(" XXX "); sb.append(ret[i][j]).append(" "); } System.out.println(sb.substring(0, sb.length() - 1)); } } private static void solve(int[][] board, int dx, int dy) { Queue q = new LinkedList(); q.offer(new int[] {0, 0}); int step = 0; while (!q.isEmpty()) { step++; int size = q.size(); for (int i = 0; i < size; i++) { int[] cur = q.poll(); for (int j = 0; j < DIR.length; j++) { int next_row = cur[0] + DIR[j][0] * dx, next_col = cur[1] + DIR[j][1] * dy; if (next_row >= 0 && next_col >= 0 && next_row < board.length && next_col < board[0].length && board[next_row][next_col] == 0) { board[next_row][next_col] = step; q.offer(new int[] {next_row, next_col}); } int next_row_ = cur[0] + DIR[j][0] * dy, next_col_ = cur[1] + DIR[j][1] * dx; if (next_row_ >= 0 && next_col_ >= 0 && next_row_ < board.length && next_col_ < board[0].length && board[next_row_][next_col_] == 0) { board[next_row_][next_col_] = step; q.offer(new int[] {next_row_, next_col_}); } } } } } /* private static void solve(int[][] board, int row, int col, int dx, int dy, int step) { if (row < 0 || col < 0 || row >= board.length || col >= board[0].length) return; if (board[row][col] == 0) board[row][col] = step; else if (board[row][col] <= step) return; for (int i = 0; i < 4; i++) { int next_row = row + DIR[i][0] * dx, next_col = col + DIR[i][1] * dy; solve(board, next_row, next_col, dx, dy, step + 1); int next_row_ = row + DIR[i][0] * dy, next_col_ = col + DIR[i][1] * dx; solve(board, next_row_, next_col_, dx, dy, step + 1); } } */ }