#include<stdio.h> 

 #include<string.h> 

 #include<iostream> 

 #include<algorithm> 

 using namespace std; 

 int main() 

 { 

char a[15]; 

scanf("%s",a); 

while(next_permutation(a,a+strlen(a))) 

puts(a); 

return 0; 

 }