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 for (int i = 1; i < n; i++) { for (int j = 1; j < n; j++) { boolean[][] visited = new boolean[n][n]; Queue bfs = new LinkedList(); HashMap from = new HashMap(); Node newNode = new Node(0, 0); bfs.add(newNode); from.put(0 + " " + 0, 0 + " " + 0); while(bfs.size()>0) { Node myNode = bfs.poll(); if(myNode.x+i<=n-1 && myNode.y+j<=n-1 && !visited[myNode.x+i][myNode.y+j]) { bfs.add(new Node(myNode.x+i, myNode.y+j)); visited[myNode.x+i][myNode.y+j] = true; from.put(myNode.x+i + " " + (myNode.y+j), myNode.x + " " + myNode.y); } if(myNode.y-j>=0 &&myNode.x+i<=n-1 && myNode.y-j<=n-1 && !visited[myNode.x+i][myNode.y-j]) { bfs.add(new Node(myNode.x+i, myNode.y-j)); visited[myNode.x+i][myNode.y-j] = true; from.put(myNode.x+i + " " + (myNode.y-j), myNode.x + " " + myNode.y); } if(myNode.y-j>=0 && myNode.x-i>=0 && myNode.x-i<=n-1 && myNode.y-j<=n-1 && !visited[myNode.x-i][myNode.y-j]) { bfs.add(new Node(myNode.x-i, myNode.y-j)); visited[myNode.x-i][myNode.y-j] = true; from.put(myNode.x-i + " " + (myNode.y-j), myNode.x + " " + myNode.y); } if(myNode.x-i>=0 && myNode.x-i<=n-1 && myNode.y+j<=n-1 && !visited[myNode.x-i][myNode.y+j]) { bfs.add(new Node(myNode.x-i, myNode.y+j)); visited[myNode.x-i][myNode.y+j] = true; from.put(myNode.x-i + " " + (myNode.y+j), myNode.x + " " + myNode.y); } if(myNode.x+j<=n-1 && myNode.y+i<=n-1 && !visited[myNode.x+j][myNode.y+i]) { bfs.add(new Node(myNode.x+j, myNode.y+i)); visited[myNode.x+j][myNode.y+i] = true; from.put(myNode.x+j + " " + (myNode.y+i), myNode.x + " " + myNode.y); } if(myNode.y-i>=0 && myNode.x+j<=n-1 && myNode.y-i<=n-1 && !visited[myNode.x+j][myNode.y-i]) { bfs.add(new Node(myNode.x+j, myNode.y-i)); visited[myNode.x+j][myNode.y-i] = true; from.put(myNode.x+j + " " + (myNode.y-i), myNode.x + " " + myNode.y); } if(myNode.x-j>=0 && myNode.x-j<=n-1 && myNode.y+i<=n-1 && !visited[myNode.x-j][myNode.y+i]) { bfs.add(new Node(myNode.x-j, myNode.y+i)); visited[myNode.x-j][myNode.y+i] = true; from.put(myNode.x-j + " " + (myNode.y+i), myNode.x + " " + myNode.y); } if(myNode.x-j>=0 && myNode.y-i>=0 && myNode.x-j<=n-1 && myNode.y-i<=n-1 && !visited[myNode.x-j][myNode.y-i]) { bfs.add(new Node(myNode.x-j, myNode.y-i)); visited[myNode.x-j][myNode.y-i] = true; from.put(myNode.x-j + " " + (myNode.y-i), myNode.x + " " + myNode.y); } } if(from.containsKey(n-1 + " " + (n-1))) { int count = 1; String s = from.get(n-1 + " " + (n-1)); while (!s.equals(0 + " " + 0)) { count++; s=from.get(s); } System.out.print(count + " "); } else { System.out.print(-1 + " "); } } System.out.println(); } } } class Node { int x; int y; Node(int x, int y) { this.x = x; this.y = y; } }