#include <bits/stdc++.h>
using namespace std;
template <typename T>
T next_int() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return p * x;
}
string next_token() {
  char ch;
  string ans = "";
  do {
    ch = getchar();
  } while (ch <= ' ');
  while (ch > ' ') {
    ans += ch;
    ch = getchar();
  }
  return ans;
}
const long long INF = (long long)1e18 + 227 + 1;
const int INFINT = (int)1e9 + 227 + 1;
const int MAXN = (int)1e6 + 227 + 1;
const int MOD = (int)1e9 + 7;
const long double EPS = 1e-9;
long long bin_pow(long long a, long long b, long long MOD) {
  if (!b) return 1;
  long long ans = bin_pow(a, b / 2, MOD);
  ans = ans * ans % MOD;
  if (b % 2) ans = ans * a % MOD;
  return ans;
}
int main() {
  int n;
  cin >> n;
  deque<int> a;
  for (int i = 0; i < n; i++) a.push_back(i);
  for (int i = 2; i <= n; i++) {
    int len = a.size();
    int kek = len / i * i;
    if (kek >= len) kek -= i;
    for (int j = kek; j >= 0; j -= i) {
      if (j + i >= len) {
        a.push_back(a[j]);
      } else
        a[j + i] = a[j];
    }
    a.pop_front();
  }
  for (int i = 0; i < n; i++) cout << a[i] + 1 << " ";
  puts("");
}
