#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
int n, p[3 * N];
void Read_in() {
  scanf("%d", &n);
  return;
}
void Put_out() {
  for (int i = 1; i <= n; i++) {
    printf("%d", p[n + i - 1]);
    if (i != n)
      printf(" ");
    else
      printf("\n");
  }
  return;
}
void QAQ() {
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int i = 2; i <= n; i++) {
    int Save1 = p[i - 1], Save2;
    for (int j = i - 1; j <= n + i - 2; j += i) {
      Save2 = p[i + j];
      if (i + j <= n + i - 2)
        p[i + j] = Save1;
      else
        p[n + i - 1] = Save1;
      Save1 = Save2;
    }
  }
  return;
}
int main() {
  Read_in();
  QAQ();
  Put_out();
  return 0;
}
