#include <bits/stdc++.h>
using namespace std;
template <typename T, typename TT>
ostream &operator<<(ostream &s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream &operator<<(ostream &s, vector<T> t) {
  s << "{";
  for (int i = 0; i < t.size(); i++)
    s << t[i] << (i == t.size() - 1 ? "" : ",");
  return s << "}" << endl;
}
int p[3000002];
int np[1000002];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  scanf("%d", &(n));
  ;
  for (int i = 0; i < n; i++) p[i] = i;
  int of = 0;
  for (int k = 2; k <= n; k++) {
    int j = 0;
    while (j < n) {
      swap(p[of + j], p[of]);
      j += k;
    }
    swap(p[of + n], p[of]);
    of++;
  }
  for (int i = 0; i < n; i++) printf("%d ", p[of + i] + 1);
  return 0;
}
