#include <bits/stdc++.h>
using namespace std;
int a[3002002], *ptr;
int n;
int inline _max(int x) { return x > n ? n : x; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) a[i] = i + 1;
  ptr = a;
  for (int i = 2; i <= n; ++i) {
    for (int j = (n - 1) / i + 1; j >= 0; --j) {
      ptr[_max(j * i + i)] = ptr[j * i];
    }
    ++ptr;
  }
  for (int i = 0; i < n; ++i) printf("%d ", ptr[i]);
  printf("\n");
  return 0;
}
