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