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