#include <bits/stdc++.h>
using namespace std;
int n, a[2000005];
void work() {
  int i, j, x, y;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) a[i] = i;
  int top = 1, bot = n;
  for (i = 2; i <= n; i++) {
    y = n % i, x = n / i, ++bot;
    a[bot] = a[bot - y];
    for (j = top + x * i; j >= top; j -= i) a[j] = a[j - i];
    ++top;
  }
  for (i = top; i <= bot; i++) printf("%d ", a[i]);
}
int main() {
  work();
  return 0;
}
