#include <bits/stdc++.h>
using namespace std;
int perm_[1000000];
int n;
int offset = 0;
int& perm(int i) { return perm_[(i + offset) % n]; }
void rot() {
  ++offset;
  if (offset == n) offset = 0;
}
void f(int k) {
  rot();
  int v = perm(n - 1);
  for (int x = k - 1; x < n; x += k) {
    int uusv = perm(x);
    perm(x) = v;
    v = uusv;
  }
  if (n % k != 0) {
    perm(n - 1) = v;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) perm(i) = i + 1;
  for (int k = 2; k <= n; ++k) {
    f(k);
  }
  for (int i = 0; i < n; ++i) {
    if (i != 0) {
      cout << " ";
    }
    cout << perm(i);
  }
  cout << "\n";
  return 0;
}
