#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int i = 2; i <= n; i++) {
    int c = a[i - 1];
    for (int j = i + 1; j <= n; j += i) swap(c, a[(j + i - 3) % n + 1]);
    a[i - 1] = c;
  }
  a[0] = a[n];
  for (int i = 1; i <= n; i++) cout << a[i - 1] << ' ';
  cout << endl;
  return 0;
}
