#include <bits/stdc++.h>
using namespace std;
deque<int> deq;
int n;
int main() {
  scanf("%d", &n);
  deq.clear();
  for (int i = 0; i <= n; i++) deq.push_back(i);
  for (int i = 2; i <= n; i++) {
    int t;
    if (n % i == 0)
      t = n - i + 1;
    else
      t = n / i * i + 1;
    deq.push_back(deq[t]);
    while (t - i >= 1) {
      deq[t] = deq[t - i];
      t -= i;
    }
    deq.pop_front();
  }
  for (int i = 1; i <= n; i++) printf("%d ", deq[i]);
  printf("\n");
  return 0;
}
