#!/bin/python3 import sys n = int(input().strip()) m = [[-1 for x in range(n)] for y in range(n)] g=1 while g<= n-1: d=1 while d<=n-1: visited=[] visited.append(((n-1),(n-1))) counter=0 cur_len=0 diff=len(visited)-cur_len if m[g][d]==-1: while len(visited)>cur_len and ((0,0)) not in visited: cur_len=len(visited) arr=visited[(len(visited)-diff):len(visited)] #print(arr) h=0 while h<=len(arr)-1: t,r=arr[h] if ((t-g)<=(n-1) and (t-g)>=0) and ((r-d)<=(n-1) and (r-d)>=0) and ((t-g,r-d)) not in visited: visited.append((t-g,r-d)) if ((t-g)<=(n-1) and (t-g)>=0) and ((r+d)<=(n-1) and (r+d)>=0) and ((t-g,r+d)) not in visited: visited.append((t-g,r+d)) if ((t+g)<=(n-1) and (t+g)>=0) and ((r-d)<=(n-1) and (r-d)>=0) and ((t+g,r-d)) not in visited: visited.append((t+g,r-d)) if ((t+g)<=(n-1) and (t+g)>=0) and ((r+d)<=(n-1) and (r+d)>=0) and ((t+g,r+d)) not in visited: visited.append((t+g,r+d)) if ((t-d)<=(n-1) and (t-d)>=0) and ((r-g)<=(n-1) and (r-g)>=0) and ((t-d,r-g)) not in visited: visited.append((t-d,r-g)) if ((t-d)<=(n-1) and (t-d)>=0) and ((r+g)<=(n-1) and (r+g)>=0) and ((t-d,r+g)) not in visited: visited.append((t-d,r+g)) if ((t+d)<=(n-1) and (t+d)>=0) and ((r-g)<=(n-1) and (r-g)>=0) and ((t+d,r-g)) not in visited: visited.append((t+d,r-g)) if ((t+d)<=(n-1) and (t+d)>=0) and ((r+g)<=(n-1) and (r+g)>=0) and ((t+d,r+g)) not in visited: visited.append((t+d,r+g)) h=h+1 diff=len(visited)-cur_len counter=counter+1 if (0,0) in visited: m[g][d]=counter m[d][g]=m[g][d] d=d+1 g=g+1 p=1 while p<=n-1: line="" g=1 while g<=n-1: line=line+" "+str(m[p][g]) g=g+1 print(line.lstrip()) p=p+1