#include <bits/stdc++.h>
using namespace std;
int a[2000010];
int main() {
  int n;
  scanf("%d", &n);
  int p = 0;
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int i = 2; i <= n; i++) {
    int t = n / i - 1;
    a[p + n + 1] = a[p + (t + 1) * i + 1];
    for (int j = t * i + 1; j >= 1; j -= i) {
      a[j + i + p] = a[j + p];
    }
    p++;
  }
  for (int i = 1 + p; i <= n + p; i++) printf("%d ", a[i]);
}
