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