#P1955B. Progressive Square
Progressive Square
Description
A progressive square of size is an matrix. Maxim chooses three integers , , and and constructs a progressive square according to the following rules:
For example, if , , , and , then the progressive square looks as follows:
Last month Maxim constructed a progressive square and remembered the values of , , and . Recently, he found an array of integers in random order and wants to make sure that these elements are the elements of that specific square.
It can be shown that for any values of , , , and , there exists exactly one progressive square that satisfies all the rules.
The first line contains an integer () — the number of test cases.
The first line of each test case contains three integers , , and (, ) — the size of the square and the values of and as described in the statement.
The second line of each test case contains integers () — the elements found by Maxim.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output "YES" in a separate line if a progressive square for the given , , and can be constructed from the array elements , otherwise output "NO".
You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.
Input
The first line contains an integer () — the number of test cases.
The first line of each test case contains three integers , , and (, ) — the size of the square and the values of and as described in the statement.
The second line of each test case contains integers () — the elements found by Maxim.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output "YES" in a separate line if a progressive square for the given , , and can be constructed from the array elements , otherwise output "NO".
You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.