#include <bits/stdc++.h>
using namespace std;
const int MAX_MEM = 1e8;
int mpos = 0;
char mem[MAX_MEM];
inline void *operator new(size_t n) {
  char *res = mem + mpos;
  mpos += n;
  assert(mpos <= MAX_MEM);
  return (void *)res;
}
inline void operator delete(void *) {}
#pragma GCC optimize("O3")
int i, j, k, l, n, m, x;
long long a[2000009];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (i = 1; i <= n; i++) a[i] = i;
  for (i = 2; i <= n; i++) {
    k = a[i - 1];
    for (j = 1; j <= n; j += i) {
      long long nxt = min(n + i - 1, i - 1 + j + i - 1);
      l = a[nxt];
      a[nxt] = k;
      k = l;
      ;
    }
  }
  for (i = n; i <= 2 * n - 1; i++) cout << a[i] << ' ';
  cout << '\n';
  exit(0);
}
