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 sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); for (int i = 1; i < n; i++) { for (int j = 1; j < n; j++) { String goal = (n - 1) + ":" + (n - 1); Set steps = new HashSet<>(); Set usedSteps = new HashSet<>(); steps.add("0:0"); int stepsCount = search(steps, usedSteps, goal, i, j, n, 1); System.out.print(stepsCount + " "); } System.out.println(); } } static int search(Set steps, Set usedSteps, String goal, int i, int j, int n, int stepsCount) { Set stepsFromCurrent = new HashSet<>(); for (String step : steps) { usedSteps.add(step); addStep(stepsFromCurrent, usedSteps, step, i, j, n); addStep(stepsFromCurrent, usedSteps, step, -i, -j, n); addStep(stepsFromCurrent, usedSteps, step, i, -j, n); addStep(stepsFromCurrent, usedSteps, step, -i, j, n); addStep(stepsFromCurrent, usedSteps, step, j, i, n); addStep(stepsFromCurrent, usedSteps, step, -j, -i, n); addStep(stepsFromCurrent, usedSteps, step, j, -i, n); addStep(stepsFromCurrent, usedSteps, step, -j, i, n); } if (stepsFromCurrent.isEmpty()) return -1; if (stepsFromCurrent.contains(goal)) { return stepsCount; } else { return search(stepsFromCurrent, usedSteps, goal, i, j, n, ++stepsCount); } } static void addStep(Set steps, Set usedSteps, String current, int i, int j, int n) { String[] coordinates = current.split(":"); int x = Integer.parseInt(coordinates[0]); int y = Integer.parseInt(coordinates[1]); if (x + i >= 0 && x + i < n && y + j >= 0 && y + j < n) { String step = (x + i) + ":" + (y + j); if (!usedSteps.contains(step)) steps.add(step); } } }