#include <stdio.h>
#include <string.h>
int main() {
    char first[85],second[85],ans[85];int left,right,i,last,N;scanf("%d",&N);while (N--) {
    left=0,right=0;scanf("%s",&ans);for (i=strlen(ans)-1;i>=0;i--) first[left++]=ans[i];scanf("%s",&ans);for (i=strlen(ans)-1;i>=0;i--) second[right++]=ans[i];
    for (i=left;i<85;first[i++]='0');for (i=0,last=0;i<right;i++) {last+=(first[i]+second[i]-96);if (last>=10) first[i]=last%10+48,last/=10; else first[i]=last+48,last=0;}
    while (last) {last+=first[i]-48;if (last>=10) first[i]=last%10+48,last/=10,i++; else first[i]=last+48,last=0;}
	for (i=84;i>=0 && first[i]=='0';i--);if (i<0) puts("0"); else {for (;i>=0;printf("%c",first[i--]));puts("");}} return 0;
}