#include <bits/stdc++.h>
using namespace std;
long long a[1000000 * 2 + 1];
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    a[i] = i;
  }
  for (long long i = 2; i <= n; i++) {
    long long head = i - 1;
    long long now = i - 1;
    long long times = 1;
    long long last = a[now + ((n - 1) / i) * i];
    a[i - 1 + n] = last;
    now = (now + ((n - 1) / i) * i);
    while (times <= (n / i)) {
      a[now] = a[now - i];
      now -= i;
      times++;
    }
  }
  for (long long i = n; i <= (2 * n - 1); i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
