N = int(input()) A = [[0 for _ in range(N)] for _ in range(N)] for i in range(N): A[i][i] = i+1 for i in range(N): if i<=N//2: j0 = N+2*i else: j0 = 2*i-N for j in range(max(2*i-N+1,0),min(2*i,N-1)+1): A[2*i-j][j] = A[i][i] for j in range(max(j0-N+1,0),min(j0,N-1)+1): A[j0-j][j] = A[i][i] for i in range(N): print(*A[i])