#!/bin/python

import sys
from itertools import permutations as perm

def build_board(n):
    return [ [-1 for _ in range(n)] for _ in range(n) ]

def build_pairs(n):
    return [[(i, j) for j in range(1, n)] for i in range(1, n)]

def legal_moves( x, y, a, b):
    m = [(x+a, y+b), (x+a, y-b), (x-a, y+b), (x-a, y-b), (x+b, y+a), (x+b, y-a), (x-b, y+a), (x-b, y-a)]
    
    return [ p for p in m if (p[0]>=0) and (p[1]>=0) and (p[0]<n) and (p[1]<n) ]

def solve_instance(n, a, b ):
    board = build_board(n)
    board[0][0] = 0
    
    starts = [(0, 0)]
    
    while len(starts) != 0:
        x, y = starts.pop()
        move_count = board[x][y] + 1
        
        for x1, y1 in legal_moves(x, y, a, b):
            if board[x1][y1] > move_count or board[x1][y1] == -1:
                starts.append( (x1, y1) )
                board[x1][y1] = move_count
    return board[n-1][n-1]
    
n = int(raw_input().strip())
# your code goes here

pairs = build_pairs(n)

for row in pairs:
    for a, b in row:
        print solve_instance(n, a, b),
        
    print