#!/bin/python3

import sys

def new_positions(new_positions,c,d, length, pre_positions):
    x_change = [d,d,-d,-d,c,c,-c,-c]
    y_change = [c,-c,c,-c,d,-d,d,-d]
    positions = set([])
    for item in new_positions:
        positions = positions | set([(item[0]+x,item[1]+y) for x,y in zip(x_change, y_change) if (0<= item[0]+x and item[0]+x < length and 0<= item[1]+y and item[1]+y < length) ])
    # positions = [(a+x,b+y) for x,y in zip(x_change, y_change)]
    return positions - pre_positions

n = int(input().strip())
# your code goes here
for i in range(1,n):
    str_row = ''
    for j in range(1,n):
        positions_all = set([])
        new_set = set([(n-1,n-1)])
        count = 0
        while len(new_set) > 0 and (0,0) not in new_set:
            positions_all = positions_all | new_set
            new_set = new_positions(new_set,i,j, n, positions_all)
            count+= 1
        str_row += str(count) + ' ' if (0,0) in new_set else str(-1) + ' '
    print(str_row.strip())