#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
while ( cin >> n ) {
vector <int> perm;
for ( int i = n; i > 0; --i )
perm.push_back ( i );
do {
for ( ??????????????????????????????????)
cout << perm[i];
cout << endl;
} while ( prev_permutation ( perm.begin(), perm.end() ) );
}
return 0;
}
自己思考(owo)