codeforces#P1761A. Two Permutations
Two Permutations
Description
You are given three integers , , and . Determine if there exist two permutations and of length , for which the following conditions hold:
- The length of the longest common prefix of and is .
- The length of the longest common suffix of and is .
A permutation of length is an array containing each integer from to exactly once. For example, is a permutation, but is not a permutation ( appears twice in the array), and is also not a permutation ( but there is in the array).
Each test contains multiple test cases. The first line contains a single integer () — the number of test cases. The description of test cases follows.
The only line of each test case contains three integers , , and ().
For each test case, if such a pair of permutations exists, output "Yes"; otherwise, output "No". You can output each letter in any case (upper or lower).
Input
Each test contains multiple test cases. The first line contains a single integer () — the number of test cases. The description of test cases follows.
The only line of each test case contains three integers , , and ().
Output
For each test case, if such a pair of permutations exists, output "Yes"; otherwise, output "No". You can output each letter in any case (upper or lower).
Note
In the first test case, and form a valid pair.
In the second test case and the third case, we can show that such a pair of permutations doesn't exist.
In the fourth test case, and form a valid pair.