#!/bin/python3 import sys n = int(input().strip()) # your code goes here target=(n-1,n-1) def knightL(x,y,n,target): v=1 pos=[(x,y,v),(x,y,v)] visited=set([(0,0)]) fine=[] while pos!=[]: i=pos.pop(0) if i[:2]==target: fine.append(i[2]) if i[:2] in visited: continue if i[0]+x=0: pos.append((i[0]+x,i[1]-y,i[2]+1)) if i[0]-x>=0 and i[1]+y=0 and i[1]-y>=0: pos.append((i[0]-x,i[1]-y,i[2]+1)) if i[0]+y=0: pos.append((i[0]+y,i[1]-x,i[2]+1)) if i[0]-y>=0 and i[1]+x=0 and i[1]-x>=0: pos.append((i[0]-y,i[1]-x,i[2]+1)) visited.add(i[:2]) if len(fine)>0: return min(fine) else: return -1 results=[] for i in range(n-1): results.append([]) for j in range(n-1): results[i].append(0) for i in range(1,n): for j in range(i,n): results[i-1][j-1]=results[j-1][i-1]=knightL(i,j,n,target) for i in range(n-1): for j in range(n-1): print(results[i][j],end=' ') print()