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