#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
int p[N];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int cur = 0;
    for (int i = 1; i <= n; ++i) {
      p[cur + i] = i;
    }
    for (int i = 2; i <= n; ++i) {
      int las = n + 1;
      for (int j = n / i * i + 1; j >= 1; j -= i) {
        p[cur + las] = p[cur + j];
        las = j;
      }
      cur++;
    }
    for (int i = 1; i <= n; ++i) {
      printf("%d%c", p[cur + i], " \n"[i == n]);
    }
  }
  return 0;
}
