#include <iostream>
#include <algorithm>#include <string>using namespace std;void DFS(string a,int i,int j){ if(i>=j) cout<<a<<endl; else for(int k=i;k<j;k++) { swap(a[i],a[k]); DFS(a,i+1,j); swap(a[i],a[k]); }}
int main()
{ string a = "12345";DFS(a,0,5);return 0;
}