#include <bits/stdc++.h>
using namespace std;
int arr[2 * 1000010];
int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  int start = 0;
  for (int i = 0; i < n; i++) arr[i] = i + 1;
  for (int i = 2; i <= n; i++, start++) {
    int p = arr[start];
    for (int j = 0; j < n; j += i) swap(arr[j + start], p);
    arr[n + start] = p;
  }
  for (int i = 0; i < n; i++) cout << arr[i + start] << ' ';
  return 0;
}
