#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const double EPS = 1e-7;
const int MAX = 1000005;
int p[2 * MAX];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) p[i] = i + 1;
  int start = 0;
  for (int k = 2; k <= n; k++) {
    int prev = 0;
    int i = 0;
    for (; i < n; i += k) swap(prev, p[start + i]);
    swap(prev, p[start + n]);
    start++;
  }
  for (int i = 0; i < n; i++) cout << p[i + n - 1] << " ";
  cout << endl;
  return 0;
}
