- Practice
- Mathematics
- Combinatorics
- Merge List

# Merge List

# Merge List

Shashank is very excited after learning about the *linked list*. He learned about how to *merge* two linked lists. When we merge two linked lists, the order of the elements of each list doesn't change. For example, if we merge and , is a valid merge, while is not a valid merge because appears before .

Shashank wants you to solve a problem for him: You are given two lists having sizes and . How many ways can we merge both the lists? It is given that all elements are distinct. As your answer can be quite large, Shashank wants you to print it .

**Input Format**

The first line contains an integer , the number of test cases.

Each of the next lines contains two integers and .

**Constraints**

**Output Format**

Print the value of the answer .

**Sample Input 0**

```
1
2 2
```

**Sample Output 0**

```
6
```

**Explanation 0**

Suppose the two lists are and . The different ways of merging these lists are given below: