Problem: You are given an array consisting of integers , , ..., . Initially , all other elements are equal to .
You have to perform operations. During the -th operation, you choose two indices and such that , and swap and .
Calculate the number of indices such that it is possible to choose the operations so that in the end.
Input Format: The first line contains a single integer () — the number of test cases. Then the description of testcases follow.
The first line of each test case contains three integers , and (; ; ).
Each of next lines contains the descriptions of the operations; the -th line contains two integers and ().
Output Format: For each test case print one integer — the number of indices such that it is possible to choose the operations so that in the end.
Note: In the first test case, it is possible to achieve for every . To do so, you may use the following operations:
- swap and ;
- swap and ;
- swap and .
In the second test case, only and are possible answers. To achieve , you have to swap and during the second operation. To achieve , you have to swap and during the second operation.