/* Problem 3--Adding Reversed Numbers
   I knew there was a reason I did these in Java.  The BigInteger class
   renders this problem trivial. */

import java.io.*;
import java.util.*;
import java.math.*;

public class prob3 {

 public static BufferedReader in;
 public static PrintStream out;
 public static StringTokenizer st;

 public static void main (String[] args) throws Exception {

  in = new BufferedReader (new FileReader ("prob3.in"));
  out = new PrintStream (new FileOutputStream ("prob3.out"));
  int cases = Integer.parseInt (in.readLine());
  for (int i=0; i < cases; i++) {//read and compute all cases
   st = new StringTokenizer (in.readLine ());
   out.println (RemLead0(reverse (new BigInteger
           (reverse(st.nextToken())).add
      (new BigInteger (reverse (st.nextToken()))).toString())));
  }
 }

/* reverse returns its reversed parameter */
 public static String reverse (String r) {

  if (r.equals ("")) return "";
  return reverse (r.substring (1))+r.charAt (0);
 }

/* RemLead0 returns the parameter with its leading zeroes removed */
 public static String RemLead0 (String r) {

  if (r.charAt (0) != '0' || r.length()==1) return r;
  return RemLead0 (r.substring (1));
 }
}
