#include <bits/stdc++.h>
using namespace std;
int f[2111111];
int main() {
  int n;
  while (cin >> n) {
    int *a = f;
    for (int i = 1; i <= n; ++i) a[i] = i;
    for (int i = 2; i <= n; i++) {
      a[n + 1] = a[(n - 1) / i * i + 1];
      for (int j = (n - 1) / i * i + 1; j >= 1; j -= i) a[j] = a[j - i];
      ++a;
    }
    for (int i = 1; i <= n; ++i) cout << a[i] << " ";
    cout << endl;
  }
  return 0;
}
