#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> p(2 * n);
  for (int i = 0; i < int(n); ++i) p[i] = i + 1;
  int beginIndex = 0;
  for (int size = 2; size <= n; ++size) {
    int index = beginIndex;
    int currentValue = p[beginIndex];
    while (index < beginIndex + n) {
      index = min(index + size, beginIndex + n);
      int t = p[index];
      p[index] = currentValue;
      currentValue = t;
    }
    ++beginIndex;
  }
  for (int i = 0; i < int(n); ++i) {
    if (i) cout << " ";
    cout << p[i + beginIndex];
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
