#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
int d[N * 2];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    d[i] = i + 1;
  }
  int i = 0;
  for (int k = 2; k <= n; ++k, ++i) {
    for (int j = (n - 1) / k; j >= 0; j--) {
      if (j * k + k > n) {
        d[i + n] = d[i + j * k];
      } else {
        d[i + j * k + k] = d[i + j * k];
      }
    }
  }
  for (int j = i; j < n + i; ++j) {
    cout << d[j] << " ";
  }
}
