#include <bits/stdc++.h>
using namespace std;
stringstream ss;
int a[10000010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = i;
  int f = 1;
  for (int i = 2; i <= n; i++) {
    int tmp = 0;
    for (int j = 0; j < n; j += i) swap(tmp, a[f + j]);
    a[f + n] = tmp;
    f++;
  }
  for (int i = 1; i <= n; i++) cout << a[f + i - 1] << " ";
  cout << endl;
  return 0;
}
