#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, cnt, len;
int a[5000005];
int main() {
  scanf("%d", &n);
  len = n;
  for (i = 1; i <= n; i++) {
    a[i] = i;
  }
  for (i = 2; i <= n; i++) {
    k = a[len - n + 1];
    for (j = len - n + 1; j <= len; j += i) {
      swap(a[j], k);
    }
    a[++len] = k;
  }
  for (j = n; j <= len; j++) {
    printf("%d ", a[j]);
  }
  printf("\n");
  return 0;
}
