#include<fstream> using namespace std; ifstream fin("1.in"); ofstream fout("1.out"); int main() { int v[100],n,s1,s2,x,i,j; fin>>n; for(i=0;i<n;i++) fin>>v[i]; for(i=0;i<n;i++) for(j=i+1;j<n;j++) { s1=0; x=v[i]; while(x>0) { s1=s1+x%10; x=x/10; } s2=0; x=v[j]; while(x>0) { s2=s2+x%10; x=x/10; } if(s1==s2) fout<<v[i]<<" "<<v[j]<<endl; } fin.close(); fout.close(); return 0; }