#include<stdio.h>
#include<stdlib.h>
#include <string.h>

char *cho(char *s){
char ss[100],*u,*p=s;
strcpy(ss,s);
u=ss+strlen(ss)-1;
while(u!=ss){*p=*u;u--;p++;}
*p=*u;
return s;
}
int main()
{

char s1[100],*s2,count[100];
int N,n1,n2,n3;
*s1='\n';
/*  *s2='\0'; */
gets(count);
N=atoi(count);
for(;N>0;N--)
{
   gets(s1);
   s2=(char*)strchr(s1,' ');
   *s2='\0';
   s2++;
n1=atoi(cho(s1));
n2=atoi(cho(s2));
sprintf(s1,"%d",n1+n2);
cho(s1);
n3=atoi(s1);   
printf("%d\n",n3);
}
return 0;}
