#include <bits/stdc++.h>
using namespace std;
int n;
deque<int> q;
int a[100010];
int main() {
  cin >> n;
  for (int j = 0; j < n; j++) q.push_back(j + 1);
  for (int i = 2; i <= n; i++) {
    int f = ((n - 1) / i) * i;
    q.push_back(q[f]);
    while (f - i >= 0) {
      q[f] = q[f - i];
      f -= i;
    }
    q.pop_front();
  }
  for (int i = 0; i < n; i++) printf("%d ", q[i]);
  return 0;
}
