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