#include <bits/stdc++.h>
using namespace std;
int n, p, i, j;
int M[30000000];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) M[i] = i;
  int k = 2;
  int r = 0;
  while (k <= n) {
    i = n - (n % k);
    M[n + r + 1] = M[i + r + 1];
    while (i > 0) {
      p = i - k + 1;
      M[p + r + k] = M[p + r];
      i -= k;
    }
    r++;
    k++;
  }
  for (int i = 0; i < n; i++) printf("%d ", M[i + r + 1]);
  printf("\n");
  return 0;
}
