#include <bits/stdc++.h>
using namespace std;
void test(int n) {
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) a[i] = i;
  for (int k = 2; k <= n; k++) {
    for (int i = 1; i < n; i++)
      if (i % k != 0) {
        swap(a[i], a[i + 1]);
      }
  }
  printf(":: %d\n", n);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  puts("");
}
const int MAXN = 1000006;
int n, a[MAXN * 2];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = i;
  int first = 1;
  for (int k = 2; k <= n; k++, first++) {
    int tmp = a[first], tmp2;
    for (int i = first; i < first + n; i += k) {
      if (i + k < first + n) {
        tmp2 = a[i + k];
        a[i + k] = tmp;
        tmp = tmp2;
      } else {
        a[first + n] = tmp;
      }
    }
  }
  for (int i = first; i < first + n; i++) {
    printf("%d%c", a[i], i == first + n - 1 ? '\n' : ' ');
  }
}
