#include <bits/stdc++.h>
using namespace std;
int v[1000000];
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) v[i] = i + 1;
  int s = 0, k, t;
  for (int i = 2; i <= n; i++, s++) {
    k = n / i * i;
    if (n % i == 0) k -= i;
    t = v[(s + k) % n];
    for (; k >= i; k -= i) v[(s + k) % n] = v[(s + k - i) % n];
    v[s] = t;
  }
  for (int i = 0; i < n; i++) cout << v[(s + i) % n] << " ";
  cout << endl;
}
