#!/bin/python3 import sys import queue memo = dict() n = int(input().strip()) memo[(1,1)] = n-1 # your code goes here for i in range(1,n): for j in range(1,n): if (min(i,j),max(i,j)) in memo: continue q = queue.Queue() q.put(((0,0),0,[])) done = set() while True: if q.empty(): memo[(min(i,j),max(i,j))] = -1 break pos, nmoves, prevmoves = q.get() if pos in done: continue done.add(pos) #if pos == (n-1, n-1): # memo[(min(i,j),max(i,j))] = nmoves # break def move(): (x,y) = pos for mx in (-1, 1): for my in (-1, 1): for r in (True, False): mv = (x+i*mx, y+j*my) if r else (x+j*mx, y+i*my) if mv == (n-1, n-1): memo[(min(i,j),max(i,j))] = nmoves+1 return if mv[0] >= 0 and mv[1] >= 0 and mv[0] < n and mv[1] < n and mv not in done: q.put((mv, nmoves+1, prevmoves + [mv])) move() if (min(i,j),max(i,j)) in memo: break print(' '.join([str(memo[(min(i,j), max(i,j))]) for j in range(1,n)]))