#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double eps = 1e-9;
int arr[2000006];
int main() {
  std::ios_base::sync_with_stdio(false);
  int i, j, n, tmp;
  cin >> n;
  for ((i) = (1); (i) < (n + 1); (i)++) arr[i] = i;
  for (i = 1; i < n; i++) {
    tmp = -1;
    for (j = i; j <= n + i; j = j + i + 1) {
      if (tmp == -1)
        tmp = arr[j];
      else
        swap(arr[j], tmp);
    }
    if (j != n + i + i + 1) arr[n + i] = tmp;
  }
  for ((i) = (n); (i) < (n + n); (i)++) cout << arr[i] << " ";
  return 0;
}
