#include <bits/stdc++.h>
using namespace std;
int n;
struct Foo {
  int n, k, p;
  Foo() { this->n = 0; }
  Foo(int n, int p, int k) {
    this->n = n;
    this->k = k;
    this->p = p;
  }
};
Foo foo[2 << 20];
int answer[1 << 20];
int main() {
  cin >> n;
  for (int p = 0; p < n; p++) {
    foo[p + 2] = Foo(p + 1, p, 2);
  }
  for (int k = 2; k <= n; k++) {
    for (int i = (2 * n - 1) / k * k; i > 0; i -= k) {
      if (foo[i].n == 0) continue;
      int newPosition = n < i ? n - 1 : i - 1;
      int newK = k + 1;
      foo[i].p = newPosition;
      foo[i].k = newK;
      foo[newPosition + newK] = foo[i];
      foo[i].n = 0;
    }
  }
  for (int i = 0; i < 2 << 20; i++) {
    if (foo[i].n == 0) continue;
    answer[foo[i].p - (n + 1 - foo[i].k)] = foo[i].n;
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", answer[i]);
  }
  return 0;
}
