#include <bits/stdc++.h>
using namespace std;
int a[2000009];
int main() {
  "ios_base::sync_with_stdio(false); cin.tie(NULL)";
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int i = 2; i <= n; i++) {
    int temp = 0;
    for (int j = i - 1; j <= n + i - 2; j += i) swap(temp, a[j]);
    a[n + i - 1] = temp;
  }
  for (int i = n; i < n * 2; i++) cout << a[i] << ' ';
  return 0;
}
