Set-Theoretic Number Notation

No attempts yetTime limit1sMemory limit128 MB

Problem

Seonyeong relies heavily on calculators and computers, so she cannot do arithmetic in her head at all. She is not alone: many of her friends also cannot perform even simple calculations without an electronic device.

So Seonyeong invented a new way of adding based on set theory. With this notation you can add non-negative integers. First, every non-negative integer is written as a set using the following rules.

  • $0$ is the empty set {}.
  • A number $n > 0$ is written as the set containing every number smaller than $n$.

Below is how $0$ through $3$ are written in this notation.

0 => {}
1 => {{}}
2 => {{},{{}}}
3 => {{},{{}},{{},{{}}}}

The number of elements in a set equals the value it represents. The elements of a set have no order, but to avoid confusion they are always written in increasing order of the size of each element (every element is itself a set).

Given two numbers written in this set notation, write a program that outputs their sum in the same set notation.

Input

The first line contains the number of test cases $T$. Each test case consists of two lines, and each line contains one number written in the set notation. The sum of the two numbers is always at most $15$.

Output

For each test case, print the sum of the two given numbers in the set notation on its own line.