#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans[2000006] = {0};
  cin >> n;
  for (int i = 1; i <= n; i++) ans[i] = i;
  for (int k = 2; k <= n; k++) {
    int rem = n % k, base = k - 1;
    ans[base + n] = ans[base + n - rem];
    for (int r = (n / k) - 1; r >= 0; r--) {
      ans[base + (r + 1) * k] = ans[base + r * k];
    }
  }
  for (int i = n; i < 2 * n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
