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