#include <bits/stdc++.h>
using namespace std;
int a[(int)(1e+6) * 5];
int main() {
  int n, i, j, k, l, r;
  cin >> n;
  for (i = 1; i <= n; i++) a[i] = i;
  for (i = 2; i <= n; i++) {
    l = a[i - 1];
    for (j = i - 1; j <= n + i - 2; j += i) {
      r = a[j + i];
      a[min(j + i, n + i - 1)] = l;
      l = r;
    }
  }
  for (i = n; i < n * 2; i++) cout << a[i] << ' ';
}
