#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 1e6 + 20;
int a[N * 2];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) a[i] = i;
  int st = 1;
  for (int k = 2; k <= n; k++) {
    int b = n / k;
    for (int l = b; l >= 0; l--) {
      if (l * k > n) continue;
      int x = l * k + st, y = min(k * (l + 1) + st - 1, st + n - 1);
      a[y + 1] = a[x];
    }
    st++;
  }
  for (int i = st; i <= st + n - 1; i++) printf("%d ", a[i]);
  return 0;
}
