#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2210000;
int ans[Maxn];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) ans[i] = i;
  for (int i = 2; i <= n; ++i) {
    int now = -1;
    for (int j = i - 1; j < n + i - 1; j += i) swap(now, ans[j]);
    ans[n + i - 1] = now;
  }
  for (int i = n; i < 2 * n; ++i) printf("%d ", ans[i]);
  return 0;
}
