- #include <iostream> 
- #include<stdio.h> 
- #include<cstring> 
- #include<map> 
- using namespace std; 
- map<string,bool>present; 
- int main() 
- { 
-     string text[5001]; 
-     char t[1000]; 
-     int no=0; 
-     while(scanf("%s",t)==1) 
-         text[no++]=t; 
-     int alpha[no][26],num[no][10]; 
-     for(int i=0;i<no;i++) 
-     { 
-         for(int j=0;j<26;j++) 
-             alpha[i][j]=0; 
-         for(int j=0;j<10;j++) 
-             num[i][j]=0; 
-     } 
-     for(int i=0;i<no;i++) 
-     { 
-         int len=text[i].length(); 
-         for(int j=0;j<len;j++) 
-             if(text[i][j]>='a'&&text[i][j]<='z') 
-                 alpha[i][text[i][j]-'a']++; 
-             else if(text[i][j]>='A'&&text[i][j]<='Z') 
-                 alpha[i][text[i][j]-'A']++; 
-             else if(text[i][j]>='0'&&text[i][j]<='9') 
-                 num[i][text[i][j]-'0']++; 
-     } 
-     bool arr[no]; 
-     for(int i=0;i<no;i++) 
-         arr[i]=0; 
-     for(int i=0;i<no;i++) 
-     { 
-         string ans=""; 
-         bool yes=0; 
-         if(!arr[i]) 
-         { 
-             int flag=0; 
-             for(int j=i+1;j<no;j++) 
-             { 
-                 if(!arr[j]) 
-                 { 
-                     bool flag1=0; 
-                     for(int z=0;z<26;z++) 
-                     { 
-                         if(alpha[i][z]!=alpha[j][z]) 
-                         { 
-                             flag1=1; 
-                             break; 
-                         } 
-                     } 
-                     if(!flag1) 
-                     { 
-                         for(int z=0;z<10;z++) 
-                         { 
-                             if(num[i][z]!=num[j][z]) 
-                             { 
-                                 flag1=1; 
-                                 break; 
-                             } 
-                         } 
-                     } 
-                     if(!flag1&&!flag) 
-                     { 
-                         present[text[i]]=1; 
-                         if(present[text[j]]) 
-                         { 
-                             present[text[j]]=0; 
-                             goto end; 
-                         } 
-                         present[text[j]]=1; 
-                         flag=1; 
-                         int l1=text[i].length(); 
-                         arr[i]=arr[j]=1; 
-                         for(int q=0;q<l1;q++) 
-                         { 
-                             if(text[i][q]>='0'&&text[i][q]<='9') 
-                                 ans+=text[i][q];                             
-                             else if(isalnum(text[i][q])) 
-                             { 
-                                 if(text[i][q]>='A'&&text[i][q]<'a') 
-                                     ans+=text[i][q]-'A'+'a'; 
-                                 else if(text[i][q]>='a') 
-                                     ans+=text[i][q]; 
-                             } 
-                         } 
-                         if(ans[ans.length()-1]!=' ') 
-                            ans+=' '; 
-                         l1=text[j].length(); 
-                         for(int q=0;q<l1;q++) 
-                         { 
-                             if(text[j][q]>='0'&&text[j][q]<='9') 
-                                 ans+=text[j][q]; 
-                             else if(isalnum(text[j][q])) 
-                             { 
-                                 if(text[j][q]>='A'&&text[j][q]<'a') 
-                                     ans+=(text[j][q]-'A'+'a'); 
-                                 else if(text[j][q]>='a') 
-                                     ans+=text[j][q]; 
-                             } 
-                         } 
-                         if(ans[ans.length()-1]!=' ') 
-                            ans+=' '; 
-                         yes=1; 
-                     } 
-                     else if(!flag1&&!present[text[j]]) 
-                     { 
-                         int l1=text[i].length(); 
-                         present[text[j]]=1; 
-                         arr[j]=1; 
-                         for(int q=0;q<l1;q++) 
-                         { 
-                             if(text[j][q]>='0'&&text[j][q]<='9') 
-                                 ans+=text[j][q]; 
-                             else if(isalnum(text[j][q])) 
-                             { 
-                                 if(text[j][q]>='A'&&text[j][q]<'a') 
-                                     ans+=(text[j][q]-'A'+'a'); 
-                                 else if(text[j][q]>='a') 
-                                     ans+=text[j][q]; 
-                             } 
-                         } 
-                         if(ans[ans.length()-1]!=' ') 
-                            ans+=' '; 
-                         yes=1; 
-                     } 
-                     end:; 
-                 } 
-             } 
-             if(yes) 
-             { 
-                 int l=ans.length()-1; 
-                 for(int h=0;h<l;h++) 
-                     putchar_unlocked(ans[h]); 
-                 putchar_unlocked('\n'); 
-             } 
-         } 
-     } 
-     return 0; 
- }