#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:536870912")
#pragma warning(disable : 4996)
using namespace std;
const int N = 3e6 + 100;
int a[N];
int main() {
  int l = 1e6 + 100, n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) a[i + l] = i + 1;
  for (int i = 2; i <= n; i++) {
    int t = 0;
    for (int j = l;; j = min(j + i, n + l)) {
      swap(t, a[j]);
      if (j == n + l) break;
    }
    l++;
  }
  for (int i = 0; i < n; i++) printf("%d ", a[i + l]);
  return 0;
}
