#include <bits/stdc++.h>
using namespace std;
int n;
void print(int *p, int sh) {
  for (int _n(n), i(0); i < _n; i++) {
    cout << p[sh] + 1 << " ";
    sh++;
    if (sh == n) sh = 0;
  }
  cout << endl;
}
void shift(int *a, int &sh, int k) {
  int t = a[sh];
  for (int i = 0; i < n;) {
    i += k;
    if (i > n) i = n;
    int idx = (i + sh) % n;
    swap(t, a[idx]);
  }
  sh++;
  if (sh == n) sh = 0;
}
int p[1000100];
int main() {
  cin >> n;
  for (int _n(n), i(0); i < _n; i++) p[i] = i;
  int sh = 0;
  for (int _n(n + 1), k(2); k < _n; k++) shift(p, sh, k);
  print(p, sh);
  return 0;
}
