#include <bits/stdc++.h>
using namespace std;
int res[1000001 * 2];
int main() {
  int n, o;
  scanf("%d", &n);
  o = 1;
  for (int i = 1; i <= n; ++i) res[i] = i;
  for (int t = 2; t <= n; ++t) {
    int l = 0, a;
    for (int j = 0, k = o; j < n; j += t, k += t) {
      a = res[k];
      res[k] = l;
      l = a;
    }
    res[o + n] = l;
    ++o;
  }
  for (int i = o, j = 0; j < n; ++i, ++j) printf("%d ", res[i]);
  printf("\n");
}
