#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  string num1,num2,tmp;
  int n;
  cin >> n;
  cin.clear();
  while(n--){
  cin >> num1 >> num2;
  if(num1.size() < num2.size()){
    tmp = num2;
    num2 = num1;
    num1 = tmp;
  }

  for(int i = 0 ; i < num1.size() ; i++ )tmp[i] = num1[i];
  for(int i = num1.size() - 1 ; i >= 0 ; i-- )
    {
      num1[i] = tmp[num1.size() - 1 - i];
    }
  for(int i = 0 ; i < num2.size() ; i++ )tmp[i] = num2[i];

  for(int i = num2.size() - 1  ; i >= 0 ; i-- )
    {
      num2[i] = tmp[num2.size() - 1 - i];
    }
  for(int i = num2.size() ; i < num1.size() ; i++ )num2+='0';
  char tmp2 = '0';
  string ans;
  for(int i = 0 ; i < num1.size() ; i++ ){
    if((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') > 9){
      ans += (((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') - 10) + '0');
      tmp2 = '1';
    } else {
      ans += (((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0')) + '0');
      tmp2 = '0'; 
    }
  }
  
  if((tmp2 - '0') + (num1[num1.size() - 1] - '0') + (num2[num1.size() - 1] - '0') > 9)ans+='1'; 

  for(int i = ans.size() ; i >= 0 ; i-- ){
    cout << ans[i];
  }  
  cout << endl;
}
  return 0;
}