You are given
You can swap any pair, that is, for the
Your task is to determine whether the conditions can be satisfied or not. If the condition can be satisfied, then print
Input Format
- The first line contains an integer
denoting the number of test cases. Description of each test case is as follows: - The first line of each test case contains two space-seperated integers
and . - The next
lines contains two space-seperated integers and denoting the pair.
Output Format
For each test case, print
Constraints
It is guaranteed that the sum of values of
In the first test case, you can swap the
In the second test case, we can show that there is no possible way to satisfy the condition.
In the third test case, there are multiple ways of satisfying the condition. One of the possible ways is to swap the 2nd and 4th pairs.
Please login to use the editor
You need to be logged in to access the code editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor