n = int(input()) def fk1(n, k): return (n-k)*k*4+1 def fk2(n, k): return (n-k-1)*k*4+2*n-1 for y in range(n): ary = []; for x in range(n): if (x + y < n): k = min(x,y) if (x >= y): ary.append(str(fk1(n, k) + (x-y)).zfill(3)) else: ary.append(str(fk1(n, k+1) + (x-y)).zfill(3)) else: k = n-max(x,y)-1 ary.append(str(fk2(n, k) - (x-y)).zfill(3)) print(" ".join(ary))