#include <bits/stdc++.h>
using namespace std;
const int sz = 3e6 + 9;
int a[sz];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) a[i] = i;
  int st = 1;
  for (int k = 2; k <= n; k++) {
    vector<int> pos;
    for (int i = st; i - st + 1 <= n; i += k) pos.push_back(i);
    pos.push_back(st + n);
    for (int i = pos.size() - 1; i >= 1; i--) swap(a[pos[i]], a[pos[i - 1]]);
    st++;
  }
  for (int i = 1; i <= 3 * n; i++)
    if (a[i] >= 1 && a[i] <= n) printf("%d ", a[i]);
  puts("");
  return 0;
}
