#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int>a(n);
iota(a.begin(), a.end(), 1);
do{
for(int i = 0; i < n; i++){
if(i) cout << ' ';
cout << a[i];
}
cout << '\n';
}while(next_permutation(a.begin(), a.end()));
return 0;
}



京公网安备 11010502036488号