#include using namespace std; using ll = long long; vector spf; map prime; void osa_k(ll n){ spf.resize(n+1); for (ll i=0; i<=n; i++) spf[i] = i; for (ll i=2; i*i<=n; i++){ if (spf[i] == i){ for (ll j=2; i*j <= n; j++){ spf[i*j] = min(spf[i*j], i); } } } } void prime_factor(ll n){ prime.clear(); while(n != 1){ prime[spf[n]]++; n /= spf[n]; } } int main(){ int N, x, y; cin >> N; osa_k(N+1); vector> v(N+1); for (int i=1; i<=N; i++){ prime_factor(i); x = 1; for (auto [p, e] : prime){ if (e % 2 == 1) x *= p; } v[x].push_back(i); } vector ans; for (int i=1; i<=N; i++){ prime_factor(i); x = 1; for (auto [p, e] : prime){ if (e % 2 == 1) x *= p; } y = v[x].back(); v[x].pop_back(); ans.push_back(y); } for (auto x : ans) cout << x << " "; cout << endl; return 0; }