#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long powm(long long base, long long exp, long long mod = 1000000007) {
  base %= mod;
  long long ans = 1;
  while (exp) {
    if (exp & 1LL) ans = (ans * base) % mod;
    exp >>= 1LL, base = (base * base) % mod;
  }
  return ans;
}
int a[2000006];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = i;
  int i;
  for (i = 2; i <= n; i++) {
    int r = i + n - 1 - (n) % i;
    if (n % i == 0) r -= i;
    a[i + n - 1] = a[r];
    for (int j = 0; j + i <= r; j += i) {
      a[r - j] = a[r - j - i];
    }
  }
  for (int j = 0; j < n; j++) {
    cout << a[i - 1 + j] << " ";
  }
}
