#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> a(2 * n);
  for (int i = 0; i < n; ++i) a[i] = i + 1;
  int L = 0, P = n - 1;
  for (int i = 2; i <= n; ++i) {
    int r = n % i;
    int akt;
    if (r != 0) {
      a[P + 1] = a[(P + 1) - r];
      akt = (P + 1) - r;
    } else
      akt = P + 1;
    while (akt > L) {
      a[akt] = a[akt - i];
      akt -= i;
    }
    ++L;
    ++P;
  }
  for (int i = L; i <= P; ++i) cout << a[i] << " ";
  return 0;
}
