#P1536A. Omkar and Bad Story
Omkar and Bad Story
Description
Omkar has received a message from Anton saying "Your story for problem A is confusing. Just make a formal statement." Because of this, Omkar gives you an array of distinct integers. An array is called nice if for any two distinct elements of , appears in at least once. In addition, all elements in must be distinct. Can you add several (maybe, ) integers to to create a nice array of size at most ? If is already nice, you don't have to add any elements.
For example, array is nice, as , which appears in the array, and , which appears in the array, while array is not nice, as is not present in the array.
For integers and , if and otherwise.
Each test contains multiple test cases. The first line contains (), the number of test cases. Description of the test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains distinct integers () — the elements of the array .
For each test case, output one line containing YES if Omkar can create a nice array by adding elements to and NO otherwise. The case of each letter does not matter, so yEs and nO will also be accepted.
If the first line is YES, output a second line containing a single integer ().
Then output one line containing distinct integers (), the elements of the nice array . can be in any order. For each in , must appear at least once in .
It can be proved that if Omkar can create such an array , then he can also do so in a way that satisfies the above constraints.
If multiple solutions exist, you can print any.
Input
Each test contains multiple test cases. The first line contains (), the number of test cases. Description of the test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains distinct integers () — the elements of the array .
Output
For each test case, output one line containing YES if Omkar can create a nice array by adding elements to and NO otherwise. The case of each letter does not matter, so yEs and nO will also be accepted.
If the first line is YES, output a second line containing a single integer ().
Then output one line containing distinct integers (), the elements of the nice array . can be in any order. For each in , must appear at least once in .
It can be proved that if Omkar can create such an array , then he can also do so in a way that satisfies the above constraints.
If multiple solutions exist, you can print any.
Samples
Note
For the first case, you can add integers to to receive the array . Note that and is in , and is in , and is in , so is nice.
For the second case, you can add integers to to receive the array . We have that is in , is in , is in , and is in , so is nice.
For the fourth case, you can add integers to to receive the array . We have that is in , is in , is in , is in , and is in , so is nice.
It can be proven that for all other test cases it is impossible to create a nice array .