#include <bits/stdc++.h>
using namespace std;
int n;
int a[3001000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) a[i] = i + 1;
  int s = 0, e = n - 1;
  for (int i = 2; i <= n; i++) {
    int id = s, foo = a[s];
    for (int j = 0; j < ((n / i) + (n % i != 0)); j++) {
      id += i;
      id = min(id, e + 1);
      swap(foo, a[id]);
    }
    s++, e++;
  }
  for (int i = s; i <= e; i++) {
    if (i != s) cout << " ";
    cout << a[i];
  }
  cout << endl;
  return 0;
}
