#!/bin/python import sys n = int(raw_input().strip()) steps = {} def solve(n, i, j): steps = -1 visited = [] curr = [[(0,0)]] while curr: steps += 1 new = curr[0] curr = curr[1:] app = [] for pos in new: if pos == (n-1, n-1): return steps a = pos[0]+i b = pos[1]+j if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) a = pos[0]+i b = pos[1]-j if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) a = pos[0]-i b = pos[1]+j if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) a = pos[0]-i b = pos[1]-j if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) a = pos[0]+j b = pos[1]+i if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) a = pos[0]+j b = pos[1]-i if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) a = pos[0]-j b = pos[1]+i if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) a = pos[0]-j b = pos[1]-i if (a,b) not in visited and a >=0 and b>=0 and a<n and b<n: visited.append((a,b)) app.append((a,b)) if app != []: curr.append(app) return -1 # your code goes here for i in range(1, n): for j in range(i+1, n): ans = solve(n, i, j) steps[(i,j)] = ans steps[(j,i)] = ans for i in range(1, n): if (n-1)%i == 0: steps[(i,i)] = (n-1)/i else: steps[(i,i)] = -1 for i in range(1, n): for j in range(1, n): print steps[(i,j)], print