#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n;
int a[2000010];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) a[i] = i;
    for (int k = 2; k <= n; k++) {
      int ed = n + k - 1, rp = n / k + (n % k != 0);
      for (int t = k - 1 + (rp - 1) * k; t >= k - 1; t -= k) {
        swap(a[ed], a[t]);
        ed = t;
      }
    }
    for (int i = n; i <= 2 * n - 1; i++) printf("%d ", a[i]);
    puts("");
  }
}
