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