#include <bits/stdc++.h>
using namespace std;
int a[2000010], n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int i = 2; i <= n; i++) {
    int k = (n % i) ? n / i + 1 : n / i;
    a[n + i - 1] = a[(k - 1) * i + i - 1];
    for (int j = k - 1; j; j--) a[j * i + i - 1] = a[(j - 1) * i + i - 1];
  }
  for (int i = n; i < 2 * n; i++) cout << a[i] << ' ';
  cout << endl;
  return 0;
}
