dx = (0,1,0,-1); dy = (-1,0,1,0) N = int(raw_input()) assert 1 <= N <= 30 whirlnumber = [[""]*N for i in xrange(N)] x,y = -1,0 number = 0 di = 1 while number < N*N: for j in xrange(N-di/2): x += dx[di%4]; y += dy[di%4] whirlnumber[y][x] = "%03d" % (number+1) number += 1 di += 1 for l in whirlnumber: print " ".join(l)