#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
deque<int> q;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    q.push_back(i);
  }
  for (int i = 2; i <= n; i++) {
    for (int j = (n - 1) / i; j > 0; j--) {
      swap(q[(j - 1) * i], q[j * i]);
    }
    q.push_back(q.front());
    q.pop_front();
  }
  for (int i = 1; i <= n; i++) {
    if (i == 1)
      cout << q.front();
    else
      cout << " " << q.front();
    q.pop_front();
  }
  cout << endl;
  return 0;
}
