import sys debug = False inf = 1e+100 def minmove(n, a, b): if debug: print('init',n,a,b) memo = [[inf]*n for i in range(n)] def move(x, y, step): if x < 0 or x > n-1: return False if y < 0 or y > n-1: return False if memo[x][y] <= step: return False memo[x][y] = step if x == n-1 and y == n-1: if debug: print('memo',x,y,step) return True step += 1 move(x+a, y+b, step) move(x+a, y-b, step) move(x-a, y+b, step) move(x-a, y-b, step) move(x+b, y+a, step) move(x+b, y-a, step) move(x-b, y+a, step) move(x-b, y-a, step) move(0, 0, 0) if memo[n-1][n-1] < inf: return memo[n-1][n-1] else: return -1 n = int(input().strip()) minmoves = [[0]*(n-1) for i in range(n-1)] for a in range(1, n): for b in range(1, a+1): i = a-1 j = b-1 minmoves[i][j] = minmove(n, a, b) minmoves[j][i] = minmoves[i][j] if debug: print('save',i,j,minmoves[i][j]) for i in range(n-1): print(" ".join([str(s) for s in minmoves[i]]))