#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
const int N = 1e6 + 5;
int a[N * 2] = {};
int n;
void shift(int start, int k) {
  int val = a[start];
  int end = start + n;
  a[start] = 0;
  for (int cur = start + k; cur <= end;) {
    int tmp = a[cur];
    a[cur] = val;
    val = tmp;
    if (cur + k <= end)
      cur += k;
    else if (cur < end)
      cur = end;
    else
      break;
  }
  return;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) a[i] = i + 1;
  int start = 0;
  int end = n - 1;
  for (int k = 2; k <= n; k++) {
    shift(start, k);
    start++;
    end++;
  }
  for (int i = start; i <= end; i++) {
    cout << a[i] << ' ';
  }
  cout << endl;
  return 0;
}
