#include <bits/stdc++.h>
const int MAX_N = int(1e6) + 20;
int N, A[2 * MAX_N];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) A[i] = i;
  for (int k = 2; k <= N; ++k) {
    if (N % k) A[N + k - 2] = A[N - N % k + k - 2];
    for (int i = N - N % k; i > 0; i -= k) A[i + k - 2] = A[i - 2];
  }
  for (int i = N - 1; i < 2 * N - 1; ++i) printf("%d ", A[i] + 1);
  puts("\n");
}
