#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1000000;
int n;
deque<int> p;
void f(int k) {
  int x = p[0];
  p.pop_front();
  p.push_back(x);
  int r = n % k;
  swap(p[n - 1], p[n - r - 1]);
  for (int i = n - r - 1; i > k - 1; i -= k) swap(p[i], p[i - k]);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) p.push_back(i);
  for (int i = 2; i <= n; i++) f(i);
  for (int i = 0; i < n; i++) cout << p[i] << ' ';
  cin.get();
  cin.get();
  return 0;
}
