#include <bits/stdc++.h>
using namespace std;
const long long mod1 = 1e9 + 7, mod2 = 998244353, K = 26, maxn = 2e6 + 10;
const double pi = acos(-1);
long long n, pos[maxn];
void solve() {
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    pos[i] = i;
  }
  for (long long k = 2; k <= n; ++k) {
    int now = k - 1;
    pos[now + n] = pos[now + (n / k) * k];
    for (int j = now + (n / k) * k; j >= now; j -= k) {
      pos[j] = pos[j - k];
    }
  }
  for (long long i = 1; i <= n; ++i) {
    cout << pos[i + n - 1] << ' ';
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
