#include <bits/stdc++.h>
using namespace std;
int wss[1002013 * 3], *s = wss;
int N;
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) wss[i] = i;
  for (int i = 2; i <= N; ++i) {
    int now = i + 1;
    while (now <= N) {
      swap(s[1], s[now]);
      now += i;
    }
    swap(s[1], s[N + 1]);
    ++s;
  }
  for (int i = 1; i <= N; ++i) printf("%d ", s[i]);
  return 0;
}
