#include <bits/stdc++.h>
using namespace std;
int a[2000000];
int main() {
  int N;
  while (scanf("%d", &N) != EOF) {
    for (int i = int(0); i < int(N); i++) a[i] = i + 1;
    for (int j = int(2); j < int(N + 1); j++) {
      int temp = 0;
      for (int k = 0; k < N; k += j) {
        swap(temp, a[j - 2 + k]);
      }
      swap(temp, a[j + N - 2]);
    }
    for (int i = int(0); i < int(N); i++)
      printf("%d%c", a[i + N - 1], " \n"[i == N - 1]);
  }
  return 0;
}
