#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   deque<int> q;   int main() {     int n;     while (~scanf( %d , &n)) {       q.clear();       for (int i = 1; i <= n; i++) q.push_back(i);       for (int i = 2; i <= n; i++) {         int k = ((n - 1) / i) * i;         int tmp = q[k];         for (int j = k; j >= i; j -= i) q[j] = q[j - i];         q[0] = tmp;         q.push_back(q.front());         q.pop_front();       }       int sz = q.size();       for (int i = 0; i < sz; i++)         if (i == 0)           printf( %d , q[i]);         else           printf(  %d , q[i]);       puts(  );     }     return 0;   }   