#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
int n;
int a[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) a[i] = i;
  int st = 0;
  for (int i = 2; i <= n; i++) {
    int tmp = a[st];
    for (int j = st; j < st + n; j += i) {
      int goal = min(j + i, st + n);
      int pre = tmp;
      tmp = a[goal];
      a[goal] = pre;
    }
    st++;
  }
  for (int i = st; i < n + st; i++) printf("%d ", a[i] + 1);
  return 0;
}
