#include <bits/stdc++.h>
using namespace std;
int arr[3000000];
int main() {
  int N, K, i;
  while (scanf("%d", &N) != EOF) {
    for (i = 0; i < N; i++) arr[i] = i + 1;
    for (K = 2; K <= N; K++) {
      int last = arr[K - 2];
      for (i = K - 2; i < K - 2 + N; i += K) {
        int tmp = min(i + K, K - 2 + N);
        swap(arr[tmp], last);
      }
    }
    for (i = K - 2; i < K - 2 + N; i++)
      printf("%d%c", arr[i], (i == K - 2 + N - 1 ? '\n' : ' '));
  }
}
