N = int(input()) ans = [i + 1 for i in range(N)] used = [0 for i in range(N)] for i in range(1, N + 1): ind = [] for j in range(1, N + 1): if i * j ** 2 > N: break if not used[i * j ** 2 - 1]: ind.append(i * j ** 2 - 1) used[i * j ** 2 - 1] = 1 for j in range(len(ind) // 2): ans[ind[j]], ans[ind[len(ind) - j - 1]] = ans[ind[len(ind) - j - 1]], ans[ind[j]] print(*ans)