#include <bits/stdc++.h>
using namespace std;
int arr[3000000];
int main() {
  int i, j, k, n, k1;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) arr[i] = i;
  int now = 1;
  for (i = 2; i <= n; i++) {
    now++;
    k = arr[now - 1];
    for (j = now + i - 1; j <= now + n - 1; j += i) {
      k1 = arr[j];
      arr[j] = k;
      k = k1;
      if (j == (now + n - 1)) break;
    }
    if (j != (now + n - 1)) {
      j = now + n - 1;
      arr[j] = k;
    }
  }
  for (i = 0; i < n; i++) {
    if (i) printf(" ");
    printf("%d", arr[now + i]);
  }
  cout << endl;
  return 0;
}
