#include <bits/stdc++.h>
using namespace std;
long x1, x2, l, r, n, m, i, j, k, a[4000000];
void go(long x, long y) {
  if (y >= r) {
    a[r] = x1;
    return;
  }
  x2 = a[y];
  a[y] = x1;
  x1 = x2;
  go(y, y + i);
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) a[i] = i;
  l = 1;
  r = n;
  for (i = 2; i <= n; i++) {
    l++;
    r++;
    k = l - 1;
    x1 = a[k];
    go(k, k + i);
  }
  for (i = l; i <= r; i++) cout << a[i] << " ";
  cout << endl;
}
