#include <bits/stdc++.h>
#pragma 03
using namespace std;
int a[2000100];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int t = 1; t < n; t++) {
    a[t + n] = a[t + (n / (t + 1)) * (t + 1)];
    int x = n / (t + 1);
    for (int j = t + (x * (t + 1)); j >= t; j -= (t + 1)) {
      a[j] = a[j - t - 1];
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i + n - 1]);
  }
  return 0;
}
