#include <iostream>
#include <cstdio>
#include <stack>

using namespace std;

int main(void){
	stack <char> buffer;
	int a[80],n,i,j;
	char buffer2;
	cin >> n;
	scanf(" ");
	for (int i = 0; i < n; i++)
	{
		for(j=0;j<80;j++) a[j]=0;
		while(1){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			buffer.push(buffer2);
		}
		buffer2 = 0;
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		while(1){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			buffer.push(buffer2);
		}
		buffer2 = 0;
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		for(j=0;a[j]!=0;j++){
			if(a[j]>=10){a[j]-=10;a[j+1]++;}
		}
		for(j=79;a[j]==0;j--);
		for(;j>=0;j--){
			cout << a[j];
		}
		cout << endl;
	}
	return 0;
}