#include <bits/stdc++.h>
using namespace std;
int a[3000000], n, *s;
int main() {
  scanf("%d", &n);
  s = a;
  int i, j;
  for (i = 1; i <= n; ++i) s[i] = i;
  for (i = 2; i <= n; ++i, ++s) {
    for (j = (n - 1) / i * i + 1; j >= 1; j -= i) {
      int x = j + i;
      if (x >= n + 1) x = n + 1;
      s[x] = s[j];
    }
  }
  for (i = 1; i <= n; ++i) printf("%d%c", s[i], " \n"[i == n]);
  return 0;
}
