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 boolean[][] board = null; int[] resRow = new int[n - 1]; // Store result per 'a' with many 'b's. for (int i = 1; i < n; i++) { for (int j = 1; j < n; j++) { int[][] moves = new int[8][2]; moves[0][0] = i; moves[0][1] = j; moves[1][0] = i; moves[1][1] = -j; moves[2][0] = -i; moves[2][1] = j; moves[3][0] = -i; moves[3][1] = -j; moves[4][0] = j; moves[4][1] = i; moves[5][0] = -j; moves[5][1] = i; moves[6][0] = j; moves[6][1] = -i; moves[7][0] = -j; moves[7][1] = -i; board = new boolean[n][n]; Queue q = new LinkedList(); q.add(new Point(0,0)); int steps = 1; int count = 1; board[0][0] = true; boolean found = false; while (q.size() > 0 && !found) { count = q.size(); while (count > 0) { Point p = q.remove(); for (int k = 0; k < moves.length; k++) { int newX = p.x + moves[k][0]; int newY = p.y + moves[k][1]; if (newX >= 0 && newX < n && newY >=0 && newY < n) { if (newX == n - 1 && newY == n - 1) { System.out.print(steps + " "); found = true; break; } else if (!board[newX][newY]) { board[newX][newY] = true; q.add(new Point(newX, newY)); } } } if (found) break; count--; } if (!found) steps++; } if (!found) System.out.print("-1 "); } System.out.print('\n'); } } static class Point { int x; int y; public Point(int a, int b) { x = a; y = b; } } }