#include <bits/stdc++.h>
using namespace std;
const int tam = 100010;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1);
int ar[3000000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) ar[i] = i + 1;
  for (int i = 2; i < n + 1; i++) {
    for (int j = (n + i - 2) - (n % i == 0 ? i : n % i); j > i - 3; j -= i) {
      ar[min(n + i - 2, j + i)] = ar[j];
    }
  }
  for (int i = n - 1; i < 2 * n - 1; i++) {
    if (i > n - 1) cout << ' ';
    cout << ar[i];
  }
  return 0;
}
