#include <bits/stdc++.h>
using namespace std;
const int max_n = 1000000;
int n;
int a[2 * max_n + 1];
int main() {
  scanf("%d", &n);
  for (int i = 2; i < n + 2; i++) a[i] = i - 1;
  for (int i = 2; i <= n; i++) {
    int target = i + n;
    int curr = (target - 1) / i * i;
    while (curr >= i) {
      a[target] = a[curr];
      target = curr;
      curr -= i;
    }
  }
  for (int j = n + 1; j <= 2 * n; j++) {
    if (j > n + 1) printf(" ");
    printf("%d", a[j]);
  }
  printf("\n");
  return 0;
}
