#include <bits/stdc++.h>
using namespace std;
int a[5000500];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    a[i] = i;
  }
  int st = 0, pr;
  for (int j = 2; j <= n; j++) {
    pr = 0;
    for (int i = 1; i <= n; i += j) {
      int t = a[i + st];
      a[i + st] = pr;
      pr = t;
    }
    a[st + n + 1] = pr;
    st++;
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i + st]);
  }
  return 0;
}
