#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using std::bitset;
using namespace std;
int a[2001000];
int n;
int main() {
  int i, j, tem;
  while (scanf("%d", &n) != EOF) {
    for (i = 1; i <= n; i++) a[i] = i;
    int add = 0;
    for (i = 2; i <= n; i++) {
      int yu = n % i;
      int last = (yu == 0 ? n + add - i + 1 : n + add - yu + 1);
      a[n + add + 1] = a[last];
      for (j = last; j - i >= 1 + add; j -= i) a[j] = a[j - i];
      add++;
    }
    for (i = 1; i <= n; i++) printf("%d%c", a[i + add], i == n ? '\n' : ' ');
  }
  return 0;
}
