#include <bits/stdc++.h>
int n, i, j, a[2000011], *s = a;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) a[i] = i;
  for (i = 2; i <= n; i++) {
    s++;
    if (n % i) s[n] = s[n - n % i];
    for (j = n - n % i; j > 0; j -= i) s[j] = s[j - i];
  }
  for (i = 1; i <= n; i++) printf("%d ", s[i]);
  return 0;
}
