#include <bits/stdc++.h>
using namespace std;
deque<int> a;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    a.push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    for (int k = (n - 1) / i; k > 0; --k) {
      swap(a[(k - 1) * i], a[k * i]);
    }
    a.push_back(a.front());
    a.pop_front();
  }
  for (int i = 1; i <= n; i++) {
    cout << a.front() << " ";
    a.pop_front();
  }
  return 0;
}
