#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
int s[N];
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= (n); i++) s[i] = i;
  for (int i = 2; i < n; i++) {
    int p = n / i * i + 1;
    if (p > n) p -= i;
    int lst = s[p + i - 2];
    for (int j = p; j > 0; j -= i) {
      if (j - i + i - 2 > 0) s[j + i - 2] = s[j - i + i - 2];
    }
    s[n + i - 1] = lst;
  }
  for (int i = 1; i <= (n - 1); i++) cout << s[i + n - 1] << " ";
  cout << s[n - 1] << endl;
  return 0;
}
