#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int n, st, nums[(MAXN << 1)];
void solve() {
  for (int k = 2; k <= n; ++k) {
    int last = st + n - n % k;
    nums[st + n] = nums[last];
    for (int i = last; i > st; i -= k) {
      nums[i] = nums[i - k];
    }
    ++st;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) nums[i] = i + 1;
  solve();
  for (int i = st; i < st + n; ++i)
    printf("%d%c", nums[i], " \n"[i == st + n - 1]);
  return 0;
}
