#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int n, m;
int a[MAXN * 3];
void change(int k) {
  int tt = n / k, temp = a[k - 1];
  if (n % k == 0) {
    tt--;
  }
  for (int i = 1; i <= tt; i++) {
    swap(temp, a[k * i + k - 1]);
  }
  a[n + k - 1] = temp;
}
int main(int argc, const char* argv[]) {
  scanf("%d", &(n));
  for (int i = 1; i <= n; i++) {
    a[i] = i;
  }
  for (int i = 2; i <= n; i++) {
    change(i);
  }
  for (int i = n; i <= 2 * n - 1; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  return 0;
}
