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