#include <bits/stdc++.h>
using namespace std;
using cd = complex<double>;
const int mod = 1e9 + 7;
const double Pi = acos(-1);
void Fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int n;
int a[2000005];
signed main() {
  Fastio();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    a[i] = i;
  }
  for (int i = 2; i <= n; i++) {
    a[i + n - 1] = a[i - 1 + (n / i) * i];
    for (int j = i - 1 + (n / i) * i; j >= i - 1; j -= i) {
      a[j] = a[j - i];
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i + n - 1] << ' ';
  }
}
