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