#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2100000, Mo = 1000000007;
int i, n, t, x, k, cnt, p, st[Maxn], a[Maxn];
int y(int x) {
  if (x > n + p) return n + p + 1;
  return x;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (i = 1; i <= n; i++) a[i] = i;
  for (k = 2; k <= n; k++) {
    for (i = n / k * k + p; i >= p; i -= k)
      if (i + 1 <= n + p) a[y(i + k + 1)] = a[i + 1];
    p++;
  }
  for (i = n; i <= 2 * n - 1; i++) cout << a[i] << ' ';
}
