#include <bits/stdc++.h>
using namespace std;
int a[2000010], i, n, st, t, t1, t2;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) a[i] = i;
  st = 1;
  for (i = 2; i <= n; i++) {
    t = a[st];
    t1 = st;
    for (; st + i <= t1 + n - 1; st += i) {
      t2 = a[st + i];
      a[st + i] = t;
      t = t2;
    }
    a[t1 + n] = t;
    st = t1 + 1;
  }
  for (i = st; i <= st + n - 2; i++) printf("%d ", a[i]);
  printf("%d\n", a[st + n - 1]);
  return 0;
}
