#include
#include
#include<stdio.h>
#include
#include<math.h>
using namespace std;
int main()
{
int num,i;
int result[1000];
cin>>num;
string s[1000];
for( i=0;i<num;i++)
{ fflush(stdin);
getline(cin,s[i]);
}
for( i=0;i<num;i++)
{
string c=(" ");
int found=s[i].find(c);
string sub1,sub2;
sub1=s[i].substr(0,found );
sub2=s[i].substr(found+1,s[i].size());
reverse(sub1.begin(),sub1.end());
reverse(sub2.begin(),sub2.end());
char *s1=&sub1[0];
char *s2=&sub2[0];
int s11=atoi(s1);
int s12=atoi(s2);
int sum=s11+s12;
int k=sum;
sum=0;
double j=0;
while(k!=0)
{
sum=sum*pow(10,1)+k%10;
k=k/10;
j++;
}
result[i]=sum;
}
for(int i=0;i<num;i++)
{
cout<<result[i]<<endl;
}
return 0;
}