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