#include <bits/stdc++.h>
using namespace std;
int a[1000010 * 2], n, st, ed;
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) a[i] = i;
    for (int i = 2, head = 1; i <= n; i++, head++) {
      if (n % i) {
        st = head + n / i * i;
        ed = head + n;
        a[ed] = a[st];
      }
      st = head + (n / i - 1) * i;
      ed = st + i;
      while (st >= head) {
        a[ed] = a[st];
        st -= i;
        ed -= i;
      }
    }
    for (int i = n; i < 2 * n; i++) printf("%d ", a[i]);
    puts("");
  }
  return 0;
}
