public static void add(String a, String b) {
    if (a.length() != b.length() && a.length() < 32 && b.length() < 32) {
      if (a.length() > b.length()) {
        StringBuilder z = new StringBuilder(b);
        z.reverse();
        while (z.length() < a.length()) {
          z.append(0);
        }
        z.reverse();
        b = z.toString();
      } else {
        StringBuilder z = new StringBuilder(a);
        z.reverse();
        while (z.length() < b.length()) {
          z.append(0);
        }
        z.reverse();
        a = z.toString();
      }
    }

    if (b.length() > 31) {
      b = "overflow";
    }
    if (a.length() > 31) {
      a = "overflow";
    }

    boolean cero = true;
    int i = 0;
    while (i < b.length() && cero == true) {
      if (b.charAt(i) != '0') {
        cero = false;
      }
      i++;
    }

    System.out.println(a + " " + b);

    if (!cero && !a.equals("overflow") && !b.equals("overflow")) {
      StringBuilder c = new StringBuilder();
      StringBuilder d = new StringBuilder();
      for (int j = 0; j < a.length(); j++) {
        if (a.charAt(j) != b.charAt(j)) {
          c.append(1);
        } else {
          c.append(0);
        }
        if (a.charAt(j) == '1' && b.charAt(j) == '1') {
          d.append(1);
        } else {
          d.append(0);
        }
      }
      a = c.toString();
      b = mult2Bin(d.toString());
      add(a, b);
    }
  }
  public void testPasDePaire() {
    Main main = new Main();
    main.add(new Carte(Denomination.DAME, CouleurCarte.PIQUE));
    main.add(new Carte(Denomination.DEUX, CouleurCarte.COEUR));
    main.add(new Carte(Denomination.DIX, CouleurCarte.TREFLE));
    main.add(new Carte(Denomination.AS, CouleurCarte.CARREAU));
    main.add(new Carte(Denomination.ROI, CouleurCarte.PIQUE));

    assertFalse(new Paire().reconnaitreMain(new ReqAnalyseMain(main)));
  }
  public void testPaireAvecJoker() {
    Main main = new Main();
    main.add(Carte.JOKER);
    main.add(new Carte(Denomination.DEUX, CouleurCarte.COEUR));
    main.add(new Carte(Denomination.DIX, CouleurCarte.TREFLE));
    main.add(new Carte(Denomination.AS, CouleurCarte.CARREAU));
    main.add(new Carte(Denomination.ROI, CouleurCarte.PIQUE));

    assertTrue(new Paire().reconnaitreMain(new ReqAnalyseMain(main)));
  }
  public void testPaireAsRoiSuperieureAsDame() {
    Main mainSuperieure = new Main();
    mainSuperieure.add(new Carte(Denomination.AS, CouleurCarte.CARREAU));
    mainSuperieure.add(new Carte(Denomination.AS, CouleurCarte.PIQUE));
    mainSuperieure.add(new Carte(Denomination.ROI, CouleurCarte.COEUR));
    mainSuperieure.add(new Carte(Denomination.ROI, CouleurCarte.PIQUE));
    mainSuperieure.add(new Carte(Denomination.CINQ, CouleurCarte.TREFLE));

    Main mainInferieure = new Main();
    mainInferieure.add(new Carte(Denomination.AS, CouleurCarte.CARREAU));
    mainInferieure.add(new Carte(Denomination.AS, CouleurCarte.COEUR));
    mainInferieure.add(new Carte(Denomination.DAME, CouleurCarte.TREFLE));
    mainInferieure.add(new Carte(Denomination.DAME, CouleurCarte.PIQUE));
    mainInferieure.add(new Carte(Denomination.SIX, CouleurCarte.CARREAU));

    ReqAnalyseMain requeteMainSuperieure = new ReqAnalyseMain(mainSuperieure);
    ReqAnalyseMain requeteMainInferieure = new ReqAnalyseMain(mainInferieure);

    assertTrue(new DeuxPaires().reconnaitreMain(requeteMainSuperieure));
    assertTrue(new DeuxPaires().reconnaitreMain(requeteMainInferieure));

    RangPoker rangMainSuperieure = requeteMainSuperieure.getRangReconnu();
    RangPoker rangMainInferieure = requeteMainInferieure.getRangReconnu();

    assertTrue(rangMainSuperieure.compareTo(rangMainInferieure) > 0);
    assertTrue(rangMainInferieure.compareTo(rangMainSuperieure) < 0);
  }
  public void testMemePaireMemeKicker() {
    Main main1 = new Main();
    main1.add(new Carte(Denomination.TROIS, CouleurCarte.CARREAU));
    main1.add(new Carte(Denomination.TROIS, CouleurCarte.PIQUE));
    main1.add(new Carte(Denomination.QUATRE, CouleurCarte.COEUR));
    main1.add(new Carte(Denomination.QUATRE, CouleurCarte.PIQUE));
    main1.add(new Carte(Denomination.DIX, CouleurCarte.TREFLE));

    Main main2 = new Main();
    main2.add(new Carte(Denomination.TROIS, CouleurCarte.CARREAU));
    main2.add(new Carte(Denomination.TROIS, CouleurCarte.COEUR));
    main2.add(new Carte(Denomination.QUATRE, CouleurCarte.TREFLE));
    main2.add(new Carte(Denomination.DIX, CouleurCarte.CARREAU));
    main2.add(new Carte(Denomination.QUATRE, CouleurCarte.PIQUE));

    ReqAnalyseMain requeteMain1 = new ReqAnalyseMain(main1);
    ReqAnalyseMain requeteMain2 = new ReqAnalyseMain(main2);

    assertTrue(new Paire().reconnaitreMain(requeteMain1));
    assertTrue(new Paire().reconnaitreMain(requeteMain2));

    RangPoker rangMain1 = requeteMain1.getRangReconnu();
    RangPoker rangMain2 = requeteMain2.getRangReconnu();

    assertTrue(rangMain1.compareTo(rangMain2) == 0);
    assertTrue(rangMain2.compareTo(rangMain1) == 0);
  }
  public void testPairesMemeDeuxPaireDifferentKicker() {
    Main mainSuperieure = new Main();
    mainSuperieure.add(new Carte(Denomination.TROIS, CouleurCarte.CARREAU));
    mainSuperieure.add(new Carte(Denomination.TROIS, CouleurCarte.PIQUE));
    mainSuperieure.add(new Carte(Denomination.CINQ, CouleurCarte.COEUR));
    mainSuperieure.add(new Carte(Denomination.CINQ, CouleurCarte.PIQUE));
    mainSuperieure.add(new Carte(Denomination.DIX, CouleurCarte.TREFLE));

    Main mainInferieure = new Main();
    mainInferieure.add(new Carte(Denomination.TROIS, CouleurCarte.CARREAU));
    mainInferieure.add(new Carte(Denomination.TROIS, CouleurCarte.COEUR));
    mainInferieure.add(new Carte(Denomination.CINQ, CouleurCarte.TREFLE));
    mainInferieure.add(new Carte(Denomination.CINQ, CouleurCarte.CARREAU));
    mainInferieure.add(new Carte(Denomination.HUIT, CouleurCarte.PIQUE));

    ReqAnalyseMain requeteMainSuperieure = new ReqAnalyseMain(mainSuperieure);
    ReqAnalyseMain requeteMainInferieure = new ReqAnalyseMain(mainInferieure);

    assertTrue(new DeuxPaires().reconnaitreMain(requeteMainSuperieure));
    assertTrue(new DeuxPaires().reconnaitreMain(requeteMainInferieure));

    RangPoker rangMainSuperieure = requeteMainSuperieure.getRangReconnu();
    RangPoker rangMainInferieure = requeteMainInferieure.getRangReconnu();

    assertTrue(rangMainSuperieure.compareTo(rangMainInferieure) > 0);
    assertTrue(rangMainInferieure.compareTo(rangMainSuperieure) < 0);
  }
 public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);
   int n = Integer.parseInt(sc.nextLine());
   for (int i = 0; i < n; i++) {
     String l[] = sc.nextLine().split(" ");
     String a = l[0];
     String b = l[1];
     add(a, b);
     if (i < n - 1) {
       System.out.println();
     }
   }
 }