#include <bits/stdc++.h>
using namespace std;
int a[1000010];
int tmp[1000010];
int main() {
  int n, s = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    a[i] = i;
  }
  for (int i = 2; i <= n; ++i) {
    int cnt = 0;
    for (int j = s + 1;; j += i) {
      if (j > n) j -= n;
      tmp[cnt++] = a[j];
      if (cnt >= (n + i - 1) / i) break;
    }
    a[s + 1] = tmp[cnt - 1];
    int cnt2 = 0;
    for (int j = s + 1 + i;; j += i) {
      if (j > n) j -= n;
      if (cnt2 == cnt - 1) break;
      a[j] = tmp[cnt2++];
    }
    s++;
    s %= n;
  }
  int flag = 0;
  for (int k = s + 1; k <= n; ++k) {
    if (flag) printf(" ");
    printf("%d", a[k]);
    flag = 1;
  }
  for (int k = 1; k <= s; ++k) {
    if (flag) printf(" ");
    printf("%d", a[k]);
    flag = 1;
  }
  printf("\n");
}
