#include <bits/stdc++.h>
using namespace std;
int n, h, t, dec, i, End, P, Q[2000005], a[2000005];
void Print(int x) {
  if (!x) return;
  Print(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  scanf("%d", &n);
  h = 1;
  t = n;
  for (i = 1; i <= n; i++) a[i] = i;
  for (P = 2; P <= n; P++) {
    *Q = 0;
    for (i = h; i <= t; i += P) Q[++*Q] = i;
    End = a[Q[*Q]];
    for (i = (*Q) - 1; i > 0; i--) a[Q[i + 1]] = a[Q[i]];
    a[++t] = End;
    h++;
  }
  for (i = h; i <= t; i++) Print(a[i]), putchar(' ');
}
