#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long n, dvyg, a[3000000];
long long pointer;
int main() {
  cin >> n;
  dvyg = 1;
  for (int i = 1; i <= n; ++i) a[i] = i;
  for (int i = 2; i <= n; ++i) {
    pointer = n / i * i + dvyg;
    for (int j = pointer; j >= dvyg; j -= i) {
      if (j == pointer)
        a[dvyg + n] = a[j];
      else
        a[j + i] = a[j];
    }
    ++dvyg;
  }
  for (int i = dvyg; i < dvyg + n; ++i) cout << a[i] << " ";
  return 0;
}
