#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = (1uLL << 63) - 1;
const long long mod = 1000000007;
const int N = 150 + 5;
const double Pi = acos(-1.0);
const int maxn = 1e5 + 5;
deque<int> Q;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) Q.push_back(i + 1);
  for (int i = 2; i <= n; i++) {
    for (int j = (n - 1) / i; j > 0; j--) {
      swap(Q[j * i], Q[j * i - i]);
    }
    Q.push_back(Q.front());
    Q.pop_front();
  }
  for (int i = 0; i < n; i++) {
    cout << Q[i] << " ";
  }
}
