import java.io.*; import java.util.*; public class Major { static int dp[][]; static void solve(int a,int b) { dp[0][0] = 0; Queue q = new LinkedList<>(); q.add(new Node(0, 0)); while (!q.isEmpty()) { Node temp = q.remove(); int x = temp.x; int y = temp.y; if (x - a >= 0 && y + b < dp.length) { if(dp[x - a][y + b] > dp[x][y] + 1) { q.add(new Node(x - a, y + b)); dp[x - a][y + b] = dp[x][y] + 1; } } if (x - a >= 0 && y - b >= 0) { if(dp[x - a][y - b] > dp[x][y] + 1) { q.add(new Node(x - a, y - b)); dp[x - a][y - b] = dp[x][y] + 1; } } if (x + a < dp.length && y + b < dp.length) { if(dp[x + a][y + b] > dp[x][y] + 1) { q.add(new Node(x + a, y + b)); dp[x + a][y + b] = dp[x][y] + 1; } } if (x + a < dp.length && y - b >= 0) { if(dp[x + a][y - b] > dp[x][y] + 1) { q.add(new Node(x + a, y - b)); dp[x + a][y - b] = dp[x][y] + 1; } } if (x - b >= 0 && y + a < dp.length) { if(dp[x - b][y + a] > dp[x][y] + 1) { q.add(new Node(x - b, y + a)); dp[x - b][y + a] = dp[x][y] + 1; } } if (x - b >= 0 && y - a >= 0) { if(dp[x - b][y - a] > dp[x][y] + 1) { q.add(new Node(x - b, y - a)); dp[x - b][y - a] = dp[x][y] + 1; } } if (x + b < dp.length && y - a >= 0) { if(dp[x + b][y - a] > dp[x][y] + 1) { q.add(new Node(x + b, y - a)); dp[x + b][y - a] = dp[x][y] + 1; } } if (x + b < dp.length && y + a < dp.length) { if(dp[x + b][y + a] > dp[x][y] + 1) { q.add(new Node(x + b, y + a)); dp[x + b][y + a] = dp[x][y] + 1; } } } } static class Node { int x; int y; Node(int x,int y){ this.x = x; this.y = y; } } public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringBuilder sb = new StringBuilder(); int ans[][] = new int[n][n]; for(int i = 1;i < n;i++){ for(int j = i;j < n;j++){ dp = new int[n][n]; for(int k = 0;k < n;k++) Arrays.fill(dp[k],Integer.MAX_VALUE/2); solve(i,j); ans[i][j] = ans[j][i] = dp[n - 1][n - 1]; if(ans[i][j] == Integer.MAX_VALUE/2){ ans[i][j] = ans[j][i] = -1; } } } for(int i = 1;i < n;i++){ for(int j = 1;j < n;j++){ sb.append(ans[i][j] + " "); } sb.append('\n'); } System.out.print(sb); } }