#!/bin/python import sys n = int(raw_input().strip()) # your code goes here a = 1 b = 1 tests = [(0,0,0)] tested = set() def test(x,y,c): global a, b, tests if (x,y) in tested: return -1 tested.add((x,y)) if x >= n or x < 0 or y >= n or y < 0: return -1 if x == n-1 and y == n-1: return c tests.append((x+a, y+b, c+1)) tests.append((x+a, y-b, c+1)) tests.append((x-a, y+b, c+1)) tests.append((x-a, y-b, c+1)) tests.append((x+b, y+a, c+1)) tests.append((x+b, y-a, c+1)) tests.append((x-b, y+a, c+1)) tests.append((x-b, y-a, c+1)) def find(a_, b_): global a, b, tests, tested a, b = a_, b_ i = 0 tests = [(0,0,0)] tested = set() while i < len(tests): x,y,c = tests[i] i += 1 r = test(x,y,c) if r > 0: return r return -1 def run(): results = dict() for i in range(1, n): for j in range(i,n): r = find(i, j) # print i, j, r results[(i,j)] = r results[(j,i)] = r for i in range(1,n): for j in range(1,n): print results[(i,j)], print "\n", if __name__ == '__main__': run()