#!/bin/python import sys from collections import deque n = int(input().strip()) for i in range(1,n): curans = [] for j in range(1,n): goal = False di = {(0,0) : 0} valid = False q = deque() q.append((0,0)) tried = set() while not goal: valid = False temp = q.popleft() # x - i if temp[0] - i >= 0: # y - j if (temp[1] - j) >= 0: if (temp[0] - i,temp[1] - j) not in tried: q.append((temp[0] - i,temp[1] - j)) tried.add((temp[0] - i,temp[1] - j)) di[(temp[0] - i,temp[1] - j)] = di[temp] + 1 # y + j if (temp[1] + j) <= (n-1): if (temp[0] - i,temp[1] + j) not in tried: q.append((temp[0] - i,temp[1] + j)) tried.add((temp[0] - i,temp[1] + j)) di[(temp[0] - i,temp[1] + j)] = di[temp] + 1 # x + i if temp[0] + i <= (n-1): # y - j if (temp[1] - j) >= 0: if (temp[0] + i,temp[1] - j) not in tried: q.append((temp[0] + i,temp[1] - j)) tried.add((temp[0] + i,temp[1] - j)) di[(temp[0] + i,temp[1] - j)] = di[temp] + 1 # y + j if (temp[1] + j) <= (n-1): if (temp[0] + i,temp[1] + j) not in tried: q.append((temp[0] + i,temp[1] + j)) tried.add((temp[0] + i,temp[1] + j)) di[(temp[0] + i,temp[1] + j)] = di[temp] + 1 # x - j if temp[0] - j >= 0: # y - i if (temp[1] - i) >= 0: if (temp[0] - j,temp[1] - i) not in tried: q.append((temp[0] - j,temp[1] - i)) tried.add((temp[0] - j,temp[1] - i)) di[(temp[0] - j,temp[1] - i)] = di[temp] + 1 # y + i if (temp[1] + i) <= (n-1): if (temp[0] - j,temp[1] + i) not in tried: q.append((temp[0] - j,temp[1] + i)) tried.add((temp[0] - j,temp[1] + i)) di[(temp[0] - j,temp[1] + i)] = di[temp] + 1 # x + j if temp[0] + j <= (n-1): # y - i if (temp[1] - i) >= 0: if (temp[0] + j,temp[1] - i) not in tried: q.append((temp[0] + j,temp[1] - i)) tried.add((temp[0] + j,temp[1] - i)) di[(temp[0] + j,temp[1] - i)] = di[temp] + 1 # y + i if (temp[1] + i) <= (n-1): if (temp[0] + j,temp[1] + i) not in tried: q.append((temp[0] + j,temp[1] + i)) tried.add((temp[0] + j,temp[1] + i)) di[(temp[0] + j,temp[1] + i)] = di[temp] + 1 if (n-1,n-1) in di: goal = True curans.append(di[(n-1,n-1)]) if len(q) == 0: goal = True curans.append(-1) for l in range(len(curans)): print(str(curans[l]) + " ",end="") print("")