#include <bits/stdc++.h>
using namespace std;
int n;
int a[2000010], b[2000010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) a[i] = i;
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= n / i; ++j) b[i - 1 + j * i] = a[i - 1 + j * i - i];
    if (n % i != 0) b[i + n - 1] = a[i - 1 + n / i * i];
    for (int j = 1; j <= n / i; ++j) a[i - 1 + j * i] = b[i - 1 + j * i];
    if (n % i != 0) a[i + n - 1] = b[i + n - 1];
  }
  for (int i = n; i < n + n - 1; ++i) printf("%d ", a[i]);
  printf("%d\n", a[n + n - 1]);
  return 0;
}
