#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 2000006;
int n;
int a[N];
void solv() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    a[i] = i;
  }
  vector<pair<int, int> > v;
  for (int k = 2; k <= n; ++k) {
    v.clear();
    for (int u = 1; u <= n; u += k) {
      int nu;
      if (u + k - 1 <= n)
        nu = u + k - 1;
      else
        nu = n;
      int i = a[u + (k - 2)];
      v.push_back(make_pair(nu + (k - 1), i));
    }
    for (int i = 0; i < ((int)(v).size()); ++i) a[v[i].first] = v[i].second;
  }
  for (int u = 1; u <= n; ++u) {
    int i = a[u + (n - 1)];
    printf("%d ", i);
  }
  printf("\n");
}
int main() {
  solv();
  return 0;
}
