#include <bits/stdc++.h>
using namespace std;
int n;
int nums[2000000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) nums[i] = i + 1;
  int start = 0;
  for (int i = 2; i <= n; ++i) {
    int pos = start;
    int temp = nums[pos];
    ++start;
    while (true) {
      pos += i;
      if (pos - start >= n - 1) {
        nums[start + n - 1] = temp;
        break;
      }
      int temp2 = nums[pos];
      nums[pos] = temp;
      temp = temp2;
    }
  }
  for (int i = start; i < start + n - 1; ++i) cout << nums[i] << ' ';
  cout << nums[start + n - 1] << endl;
}
