#!/bin/python3 import sys n = int(input().strip()) moves = [[0 for x in range(n - 1)] for y in range(n - 1)] for i in range(1, n): for j in range(i, n): lookup = [[(0,0)]] current = set() current.add((0,0)) unvisited = set() for k in range(n): for l in range(n): unvisited.add((k,l)) unvisited.remove((0,0)) d = 0 while len(unvisited) > 0: current = set() for loc in lookup[d]: if (loc[0] + i < n) and (loc[1] + j < n) and ((loc[0] + i, loc[1] + j) in unvisited): current.add((loc[0] + i, loc[1] + j)) if (loc[0] + i < n) and (loc[1] - j >= 0) and ((loc[0] + i, loc[1] - j) in unvisited): current.add((loc[0] + i, loc[1] - j)) if (loc[0] - i >= 0) and (loc[1] + j < n) and ((loc[0] - i, loc[1] + j) in unvisited): current.add((loc[0] - i, loc[1] + j)) if (loc[0] - i >= 0) and (loc[1] - j >= 0) and ((loc[0] - i, loc[1] - j) in unvisited): current.add((loc[0] - i, loc[1] - j)) if (loc[0] + j < n) and (loc[1] + i < n) and ((loc[0] + j, loc[1] + i) in unvisited): current.add((loc[0] + j, loc[1] + i)) if (loc[0] + j < n) and (loc[1] - i >= 0) and ((loc[0] + j, loc[1] - i) in unvisited): current.add((loc[0] + j, loc[1] - i)) if (loc[0] - j >= 0) and (loc[1] + i < n) and ((loc[0] - j, loc[1] + i) in unvisited): current.add((loc[0] - j, loc[1] + i)) if (loc[0] - j >= 0) and (loc[1] - i >= 0) and ((loc[0] - j, loc[1] - i) in unvisited): current.add((loc[0] - j, loc[1] - i)) if (n - 1, n - 1) in current: moves[i - 1][j - 1] = d + 1 moves[j - 1][i - 1] = d + 1 break if current == set(): moves[i - 1][j - 1] = -1 moves[j - 1][i - 1] = -1 break unvisited -= current lookup.append(current) d += 1 for a in moves: for b in a: print(b, end=' ') print()