#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1000001;
int n, a[2 * N + 5];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int cur = 1, lst = n;
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int k = 2; k <= n; k++) {
    int r = n / k;
    int rem = n - r * k;
    a[lst + 1] = a[lst - rem + 1];
    int save = a[cur];
    for (int i = cur + k; i <= lst - rem + 1; i += k) {
      int x = a[i];
      a[i] = save;
      save = x;
    }
    ++cur;
    ++lst;
  }
  for (int i = cur; i <= lst; i++) cout << a[i] << ' ';
  return 0;
}
