#include <bits/stdc++.h>
const int maxn = 5e4 + 10;
using namespace std;
deque<int> dq;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) dq.push_back(i);
  for (int i = 2; i <= n; i++) {
    int k = (n - 1) / i * i;
    dq.push_back(dq[k]);
    while (k - i >= 0) {
      dq[k] = dq[k - i];
      k -= i;
    }
    dq.pop_front();
  }
  for (int i = 0; i < dq.size(); i++) cout << dq[i] << " ";
  cout << endl;
  return 0;
}
