#include <iostream>
#include <stack>
using namespace std;
int main()
{
int n;
cin>>n;
char ch;
int temp,wei;
stack<int>s1;
stack<int>s2;
stack<int>ans;
cin.get(ch);
while(n--){
temp=0;
while(cin.get(ch)&&ch!=10)
s1.push(ch-'0');
while(cin.get(ch)&&ch!=10)
s2.push(ch-'0');
while(!s1.empty()&&!s2.empty()){
wei=(s1.top()+s2.top()+temp)%10;
temp=(s1.top()+s2.top()+temp)/10;
ans.push(wei);
s1.pop();s2.pop();
}
if(s1.size()==0)
while(!s2.empty()){
wei=(s2.top()+temp)%10;
temp=(s2.top()+temp)/10;
ans.push(wei);
s2.pop();
}
else
while(!s1.empty()){
wei=(s1.top()+temp)%10;
temp=(s1.top()+temp)/10;
ans.push(wei);
s1.pop();
}
if(temp>0)
cout<<temp;
while(!ans.empty()){
cout<<ans.top();
ans.pop();
}
cout<<endl;
cout<<endl;
}
}
#include <stack>
using namespace std;
int main()
{
int n;
cin>>n;
char ch;
int temp,wei;
stack<int>s1;
stack<int>s2;
stack<int>ans;
cin.get(ch);
while(n--){
temp=0;
while(cin.get(ch)&&ch!=10)
s1.push(ch-'0');
while(cin.get(ch)&&ch!=10)
s2.push(ch-'0');
while(!s1.empty()&&!s2.empty()){
wei=(s1.top()+s2.top()+temp)%10;
temp=(s1.top()+s2.top()+temp)/10;
ans.push(wei);
s1.pop();s2.pop();
}
if(s1.size()==0)
while(!s2.empty()){
wei=(s2.top()+temp)%10;
temp=(s2.top()+temp)/10;
ans.push(wei);
s2.pop();
}
else
while(!s1.empty()){
wei=(s1.top()+temp)%10;
temp=(s1.top()+temp)/10;
ans.push(wei);
s1.pop();
}
if(temp>0)
cout<<temp;
while(!ans.empty()){
cout<<ans.top();
ans.pop();
}
cout<<endl;
cout<<endl;
}
}