import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(read()) A = np.zeros((N+2,N+2),np.int32) A[0] = -1 A[-1] = -1 A[:,0] = -1 A[:,-1] = -1 x,y = 1,1 dx,dy = 0,1 A[1,1] = 1 for _ in range(N*N-1): if A[x+dx,y+dy] != 0: dx,dy = dy,-dx A[x+dx,y+dy] = A[x,y] + 1 x += dx y += dy A = A[1:-1,1:-1] for row in A: print(' '.join('{:03}'.format(x) for x in row))