#include <bits/stdc++.h>
using namespace std;
int n, a[2222222];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) a[i] = i + 1;
  for (int i, d = 2; d <= n; d++) {
    a[n + d - 2] = a[i = n + d - 2 - n % d];
    for (; i > 0; i -= d) a[i] = a[i - d];
  }
  for (int i = 0; i < n; i++) cout << a[i + n - 1] << " ";
  return 0;
}
