#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
int ans[maxn];
int pos[maxn];
int id[2 * maxn];
int cao[maxn];
int sta[maxn], top;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    memset(id, -1, sizeof(id));
    for (int i = 0; i < n; i++) pos[i] = i;
    for (int i = 0; i < n; i++) id[i] = i;
    for (int k = 2; k <= n; k++) {
      top = 0;
      for (int i = 0; i < n; i += k) {
        sta[top++] = id[i + k - 2];
      }
      for (int i = 0; i < top; i++) {
        int x = sta[i];
        pos[x] += k;
        if (pos[x] - (k - 1) >= n) pos[x] = n - 1 + k - 1;
        id[pos[x]] = x;
      }
    }
    for (int i = 0; i < n; i++) ans[pos[i] - (n - 1)] = i;
    for (int i = 0; i < n; i++) printf("%d ", ans[i] + 1);
    puts("");
  }
}
