#include <bits/stdc++.h>
using namespace std;
inline void fu(int &st, int &ed, vector<int> &vec, int k) {
  int tmp = vec[st];
  for (int i = st;; i += k) {
    if (i > ed + 1) i = ed + 1;
    swap(vec[i], tmp);
    if (i == ed + 1) break;
  }
  st++, ed++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> vec(n * 2 + 2);
  for (int i = 1; i <= n; i++) vec[i - 1] = i;
  int st = 0, ed = n - 1;
  for (int k = 2; k <= n; k++) fu(st, ed, vec, k);
  for (int i = st; i <= ed; i++) cout << vec[i] << " \n"[i == ed];
  return 0;
}
