#include <bits/stdc++.h>
using namespace std;
int a[2000007];
int n;
int main() {
  int i, k;
  while (~scanf("%d", &n)) {
    for (i = 1; i <= n; ++i) a[i] = i;
    for (k = 2; k <= n; ++k) {
      int st = k - 1;
      for (i = st; i + k <= n + k - 2; i += k) {
        swap(a[st], a[i + k]);
      }
      swap(a[st], a[n + k - 1]);
    }
    for (i = n; i < 2 * n - 1; ++i) printf("%d ", a[i]);
    printf("%d\n", a[2 * n - 1]);
  }
}
