#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  deque<int> D;
  for (int i = 1; i <= N; ++i) D.push_back(i);
  for (int k = 2; k <= N; ++k) {
    int x = D.front();
    D.pop_front();
    for (int i = k - 1; i < N - 1; i += k) swap(x, D[i]);
    D.push_back(x);
  }
  for (int i = 0; i < N; ++i) cout << D[i] << ' ';
  cout << '\n';
  return 0;
}
