N = int(input()) perm = [i + 1 for i in range(N)] def issquare(n): return n ** (1/2) == int(n ** (1/2)) for i in range(N): for j in range(N - 1, i, -1): if perm[i] < perm[j]: if issquare(perm[j] * (i + 1)): perm[i], perm[j] = perm[j], perm[i] break print(perm)