#include <bits/stdc++.h>
using namespace std;
int p[3010000], n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) p[i] = i;
  for (int i = 2; i < n + 1; i++) {
    int s = p[i - 1], ns;
    for (int j = i - 1; j <= n + i - 2; j += i) {
      ns = p[j + i];
      if (j + i <= n + i - 2)
        p[j + i] = s;
      else
        p[n + i - 1] = s;
      s = ns;
    }
  }
  for (int i = 1; i < n + 1; i++) printf("%d ", p[n - 1 + i]);
}
