def main(): N = int(input()) ans = [[-1]*N for _ in range(N)] for i in range(1, N+1): for j in range(1, N+1): v = 2*i - j v %= N if v == 0: v = N ans[i-1][j-1] = v for i in range(N): print(*ans[i]) if __name__ == '__main__': main()