#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 3e6 + 5;
const double eps = 1e-9;
using namespace std;
int a[MAXN];
int main() {
  int n;
  scanf("%d", &(n));
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int i = 2; i <= n; i++) {
    int cur = a[i - 1], nx = 0;
    for (int j = i - 1; j <= n + i - 2; j += i) {
      nx = a[i + j];
      if (i + j <= n + i - 2)
        a[i + j] = cur;
      else
        a[n + i - 1] = cur;
      cur = nx;
    }
  }
  for (int i = n; i < 2 * n; i++) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
