#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void smn(T &a, const T &b) {
  if (b < a) a = b;
}
template <class T>
inline void smx(T &a, const T &b) {
  if (b > a) a = b;
}
template <class T>
inline T _rev(const T &a) {
  T _ = a;
  reverse(_.begin(), _.end());
  return _;
}
const double eps = 1e-8;
const long double leps = 1e-14;
const int MN = 1000000 * 3;
int n;
int no[MN];
int p;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  p = 0;
  for (int i = 0; i < n; i++) no[i] = i + 1;
  for (int i = 2; i <= n; i++) {
    vector<int> list;
    for (int j = p; j < p + n; j += i) list.push_back(j);
    no[p + n] = no[list.back()];
    p++;
    for (int j = (int)list.size() - 2; j >= 0; j--)
      no[list[j + 1]] = no[list[j]];
  }
  for (int i = 0; i < n; i++) cout << no[p + i] << " ";
  cout << '\n';
  return 0;
}
