#!/bin/python import sys import itertools n = int(raw_input().strip()) # your code goes here times = [-1, 1] def shortest(n, i, j): dist = [[sys.maxint for _ in xrange(n)] for _ in xrange(n)] dist[0][0] = 0 queue = [(0,0)] while queue and dist[n-1][n-1] == sys.maxint: x,y = queue.pop(0) temp = dist[x][y] for i1 in times: for i2 in times: if x + i1 * i < n and x + i1 * i >= 0 and y + i2 * j < n and y + i2 * j >= 0: if dist[x + i1 * i][y + i2 * j] > temp + 1: dist[x + i1 * i][y + i2 * j] = temp + 1 queue.append((x + i1 * i, y + i2 * j)) if x + i1 * j < n and x + i1 * j >= 0 and y + i2 * i < n and y + i2 * i >= 0: if dist[x + i1 * j][y + i2 * i] > temp + 1: dist[x + i1 * j][y + i2 * i] = temp + 1 queue.append((x + i1 * j, y + i2 * i)) return dist[n-1][n-1] for i in xrange(1,n): for j in xrange(1,n): temp = shortest(n, i, j) if temp == sys.maxint: print -1, else: print temp, print ''