#include <bits/stdc++.h>
using namespace std;
const int N = 4100000;
int n, a[N], t;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) a[i] = i;
  for (int i = 1; i <= n; ++i) {
    t = (n - 1) / i * i + 1;
    a[n + i] = a[t + i - 1];
    for (int j = t + i - 1; j > i; j -= i) a[j] = a[j - i];
  }
  for (int i = n + 1; i <= 2 * n; ++i) printf("%d ", a[i]);
}
