#include <bits/stdc++.h>
using namespace std;
int a[3000006], *s, n, k;
int main() {
  scanf("%d", &n);
  for (int i = 0; i <= n - 1; ++i) a[i] = i + 1;
  for (k = 2, s = a; k <= n; ++k, ++s)
    for (int i = (n - 1) / k * k; i >= 0; i -= k)
      s[i + k >= n ? n : i + k] = s[i];
  for (int i = 0; i <= n - 1; ++i) printf("%d ", s[i]);
  puts("");
  return 0;
}
