#include <bits/stdc++.h>
using namespace std;
const int N = 2000100;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) a[i] = i;
  for (int i = 2; i <= n; ++i) {
    int s = i - 2;
    int tmp = -1;
    for (int j = 0; j < n; j += i) {
      int tmp2 = a[s + j];
      a[s + j] = tmp;
      tmp = tmp2;
    }
    a[n + s] = tmp;
  }
  for (int i = 0; i < n; ++i) printf("%d ", a[i + n - 1] + 1);
  printf("\n");
  return 0;
}
