#include <bits/stdc++.h>
using namespace std;
int n, a[3000010];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) a[i] = i + 1;
  for (int i = 2; i <= n; i++) {
    int start = i - 2;
    int div = n / i;
    if (n % i != 0) div++;
    for (int j = div - 1; j >= 0; j--) {
      int mv = j * i + start, dist = min(start + n, (j + 1) * i + start);
      a[dist] = a[mv];
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i + (n - 1)] << (i != n - 1 ? " " : "");
  }
  cout << endl;
  return 0;
}
