#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n;
deque<int> ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) ans.push_back(i);
  for (int i = 2; i <= n; ++i) {
    int prv = 0;
    for (int j = 0; j < ans.size(); j += i) swap(ans[j], prv);
    ans.pop_front();
    ans.push_back(prv);
  }
  for (int i : ans) printf("%d ", i);
  return 0;
}
