The Third Law of Thermodynamics
Time Limit: 2 Seconds Memory Limit: 32768 KB
According to the laws of thermodynamics, eventually all particles in the universe will have the same energy. This means that in a very distant future the temperature of any two points in the whole universe will be the same and nothing moves anymore!
After watching a Youtube video about this, Laurent Lavoisier is curious about this phenomenon and wants to test its truth.
Laurent starts with n integers (an extreme simplification of the particles in the universe). He then takes the minimum and maximum numbers and replaces both with their difference (i.e. if a is the maximum and b the minimum, then Laurent replaces both with a-b). He repeats the same operation over and over, until all numbers are equal.
He wants to know the final temperature of all particles when all numbers are equal, or if the video he watched is not factually correct (all numbers will never be equal), he wants his program to print "Nope!
".
Input
The first line contains the number of test cases T (1 ≤ T ≤ 32).
Each test is consist of two lines. First, an integer n (2 ≤ n ≤ 10), and the second line n whitespace-separated integers xi (-100000 ≤ xi ≤ 100000).
Output
For each test case, if the task can be done, print one of the n integers after the task is completed, otherwise if it cannot be done, print "Nope!
".
Sample Input
2 3 1 2 3 2 5 5
Sample Output
2 5Submit
Source: 15th Iran Nationwide Internet Contest