#include <bits/stdc++.h>
using namespace std;
int a[40000005];
void oku() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) a[i] = i;
  int l, k;
  for (k = 2, l = 0; k <= n; k++, l++) {
    int r = (n - 1) / k;
    a[n + l] = a[r * k + l];
    for (; r > 0; r--) {
      a[r * k + l] = a[(r - 1) * k + l];
    }
  }
  for (int i = l; i < l + n; i++) printf("%d ", a[i] + 1);
  cout << endl;
}
void oku2() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) a[i] = i;
  for (int i = 2; i <= n; i++) {
    for (int k = 0; i * k < n; k++)
      for (int j = i * k; j + 1 < min(n, i * (k + 1)); j++)
        swap(a[j], a[j + 1]);
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
}
int main() {
  oku();
  return 0;
}
