#include <bits/stdc++.h>
using namespace std;
int const N = 1000100;
int n, s;
int* a = new int[2 * N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    a[i] = i + 1;
  }
  for (int it = 2; it <= n; ++it) {
    for (int i = it; i < n; i += it) {
      swap(a[i], a[0]);
    }
    a[n] = a[0];
    ++a;
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", a[i]);
  }
  puts("");
  return 0;
}
