#include <bits/stdc++.h>
using namespace std;
int n, m;
int p[3000000];
void f(int i, int k) {
  int last = n - (m % k) + 1;
  int prev = -1;
  int j;
  for (j = i; j <= last; j += k) {
    int x = p[j];
    p[j] = prev;
    prev = x;
  }
  if (prev != -1) p[n + 1] = prev;
}
int main() {
  cin >> n;
  memset(p, -1, sizeof p);
  for (int i = 1; i <= n; i++) p[i] = i;
  m = n;
  int j = 1;
  for (int i = 2; i <= m; i++, j++) {
    f(j, i);
    n++;
  }
  int i = 1;
  while (p[i] == -1) i++;
  while (p[i] > 0) printf("%d ", p[i++]);
  printf("\n");
}
