#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  deque<int> vec(n);
  for (auto i = 0; i < (long long)(n); i++) vec[i] = i + 1;
  for (auto i = 2; i <= (long long)(n); i++) {
    int curr = vec[0];
    for (int j = i; j < n; j += i) swap(vec[j], curr);
    vec.pop_front();
    vec.push_back(curr);
  }
  for (auto i = 0; i < (long long)(n); i++) cout << vec[i] << " ";
  return 0;
}
