n = int(raw_input().strip())
from collections import OrderedDict
def main(n):
    def solve(n,x,y):
        solvable = True
        moved = [[0,0]]
     
        counter = 0
        while ([n-1,n-1] in moved) == False and solvable:
            current_arr = []
            counter += 1
            for position in moved:
               
                a = int(position[0])
                b = int(position[1])
                
                
                if (a+x) < n and  (b+y) < n:
                    current_arr.append([a+x,b+y])
                    
                if -1 < (a-x) < n and  (b+y) < n:
                    current_arr.append([a-x,b+y])
                    
                if (a+x) < n and  -1 < (b-y) < n:
                    current_arr.append([a+x,b-y])
                    
                if -1 < (a-x) < n and  -1 < (b-y) < n:
                    current_arr.append([a-x,b-y])
                    
                if (a+y) < n and  (b+x) < n:
                    current_arr.append([a+y,b+x])
                    
                if -1 < (a-y) < n and  (b+x) < n:
                    current_arr.append([a-y,b+x])
                    
                if (a+y) < n and  -1 < (b-x) < n:
                    current_arr.append([a+y,b-x])
                    
                if -1 < (a-y) < n and  -1 < (b-x) < n:
                    current_arr.append([a-y,b-x])
            for item in current_arr:
                
                if (item in moved) == False:
                    
                    moved.append(item)
            if [n-1,n-1] in current_arr:
              #  print 'we made it!!!!! ' + str(moved)
                return counter
            
            
            if counter > n*5:
               # print 'we did not make it ' + str(moved)
                solvable = False
        return -1
    for num in range(1,n):
        string = ''
        for num_two in range(1,n):
            string += str(solve(n,num,num_two)) + ' '
        print string
main(n)