#include <bits/stdc++.h>
using namespace std;
int n;
int p[2000000];
inline int mod(int x) {
  if (x < n) return x;
  return x - n;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) p[i] = i;
  int st = 0;
  for (int k = 2; k <= n; k++) {
    st++;
    int x = p[mod(st + n - 1)], v = p[mod(st + k - 1)], vv;
    for (int j = k + k - 1; j < n; j += k) {
      vv = p[mod(st + j)];
      p[mod(st + j)] = v;
      v = vv;
    }
    if (v == x)
      p[mod(st + k - 1)] = v;
    else
      p[mod(st + n - 1)] = v, p[mod(st + k - 1)] = x;
  }
  for (int i = 0; i < n; i++, st++) {
    if (st == n) st = 0;
    printf("%d%c", p[st] + 1, " \n"[i + 1 == n]);
  }
  return 0;
}
