#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000000;
int n, p[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    p[i] = i;
  }
  int lower = 0, upper = n - 1;
  for (int i = (2); i < (n + 1); i++) {
    p[upper + 1] = p[(upper - lower) / i * i + lower];
    for (int j = (upper - lower) / i * i + lower; j >= lower + i; j -= i) {
      p[j] = p[j - i];
    }
    lower++;
    upper++;
  }
  for (int i = (lower); i < (upper + 1); i++) {
    printf("%d ", p[i] + 1);
  }
  putchar('\n');
  return 0;
}
