#!/bin/python3

class Game(object):
    def __init__(self, n):
        self.n = n
        self.knights = {(a,b) for a in range(1,n) for b in range(1,a+1)}
        self.answers = {}
        self.initial = (0,0)
        self.goal = (n-1, n-1)

    def available_moves(self, pos, k):
        possible_moves = [(pos[0] + x*k[i], pos[1] + y*k[int(not i)]) 
                          for x in (1,-1) for y in (1,-1) 
                          for i in (0,1)]
        return {m for m in possible_moves 
                if min(m) >= 0 
                and max(m) < self.n}
        
    def play(self, k):
        if k in self.answers:
            return self.answers[k]
        next_moves = {self.initial}
        played_moves = {}
        move_num = 0
        while len(next_moves) > 0:
            current_moves = next_moves
            next_moves = set()
            for m in current_moves:
                if m == self.goal:
                    self.answers[k] = move_num
                    self.answers[k[::-1]] = move_num
                    return move_num
                played_moves[m] = move_num
                next_moves.update(self.available_moves(m, k))
            next_moves = next_moves.difference(played_moves.keys())
            move_num += 1
        self.answers[k] = -1
        self.answers[k[::-1]] = -1
        return -1
    
    def evaluate_all(self):
        for k in self.knights:
            x = self.play(k)
        output = [[0 for __ in range(self.n - 1)] for _ in range(self.n - 1)]
        for k,v in self.answers.items():
            output[k[0]-1][k[1]-1] = str(v)
        print('\n'.join([' '.join(_) for _ in output]))


n = int(input().strip())
game = Game(n)
game.evaluate_all()