#include <bits/stdc++.h>
using namespace std;
int n;
int p[2100000];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) p[i] = i;
  int x, y;
  for (int i = 2; i <= n; i++) {
    x = p[i - 2];
    for (int j = i - 2; j < n + i - 2; j += i) {
      if (j + i < n + i - 2) {
        y = p[j + i];
        p[j + i] = x;
        x = y;
      } else
        p[n + i - 2] = x;
    }
  }
  for (int i = 0; i < (int)(n); i++) printf("%d ", p[i + n - 1] + 1);
  puts("");
  return 0;
}
