#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
int n, p[maxn * 2];
int main() {
  scanf("%d", &n);
  for (int i = 1, _b = n; i <= _b; ++i) p[i] = i;
  int h = 1, t = n, q;
  for (int i = 2, _b = n; i <= _b; ++i) {
    q = t + 1;
    for (int j = n / i, _b = 0; j >= 0; --j) p[q] = p[j * i + h], q = j * i + h;
    ++h, ++t;
  }
  for (int i = h, _b = t; i <= _b; ++i) printf("%d ", p[i]);
  return 0;
}
