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(); int[][] result = new int[n-1][n-1]; for(int x = 1; x < n; x++){ for(int y = 1; y <= x; y++){ boolean[][] been = new boolean[n][n]; int mini = minwalk(0, 0, x, y, been); result[x-1][y-1] = mini; result[y-1][x-1] = mini; } } result[0][0] = n-1; for(int y = 0; y < n-1; y++){ for(int x = 0; x < n-1; x++){ System.out.print(result[x][y]+" "); } System.out.println(); } // your code goes here } public static int minwalk(int x, int y, int a, int b, boolean[][] been){ if((x < 0 || y < 0 || x >= been.length || y >= been.length) || (been[x][y])) return -1; if( x== been.length-1 && y == been.length-1){ return 0; } been[x][y] = true; int p1 = minwalk(x-a, y-b, a, b, been); int p2 = minwalk(x-a, y+b, a, b, been); int p3 = minwalk(x+a, y-b, a, b, been); int p4 = minwalk(x+a, y+b, a, b, been); int p5 = minwalk(x-b, y-a, a, b, been); int p6 = minwalk(x-b, y+a, a, b, been); int p7 = minwalk(x+b, y-a, a, b, been); int p8 = minwalk(x+b, y+a, a, b, been); int[] arr = new int [8]; //System.out.println(p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8); arr[0] = p1; arr[1] = p2; arr[2] = p3; arr[3] = p4; arr[4] = p5; arr[5] = p6; arr[6] = p7; arr[7] = p8; int min = 10000000; for(int i = 0; i < 8; i++){ if(arr[i]= 0) min = 1+arr[i]; } if(min == 10000000) return -1; return min; } }