#include <bits/stdc++.h>
using namespace std;
const int nMax = 2000005;
int p[nMax];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    p[i] = i + 1;
  }
  int s = 0;
  for (int j = 2; j < n + 1; ++j) {
    int curr = p[s];
    p[n + s] = p[n + s - n % j];
    for (int i = s; i <= n + s; i += j) {
      int t = p[i];
      p[i] = curr;
      curr = t;
    }
    ++s;
  }
  for (int i = s; i < n + s; ++i) {
    cout << p[i] << ' ';
  }
  return 0;
}
