#include <bits/stdc++.h>
using namespace std;
deque<int> deq;
int a[1000010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    deq.push_back(i);
  }
  for (int i = 2; i <= n; i++) {
    int l = n / i * i;
    int t = n % i;
    deq.push_back(deq[l]);
    while (true) {
      if (l - i < 0) break;
      deq[l] = deq[l - i];
      l -= i;
    }
    deq.pop_front();
  }
  for (int j = 0; j < n; j++) cout << deq[j] << " ";
  return 0;
}
