Roy and Maximum Partition

Roy and Maximum Partition

Time Limit: 4.0 s

Memory Limit: 256.0 MB

Description

You are given an array A[ ] and the length of the array is N.
You can rearrange this array A[ ]. After rearrange you can do following of the operations,

  • Divide array A[ ] into maximum block.
  • Each block has equal length
  • Each block has at least two elements.
  • Each block, different between Maximum and Minimum element should be equal for all. For example,
    A[] ={1,3,4,2}, we can divide it, two blocks : {1,3}, {4,2}.
    Different block {1,3} , Max element - Min element = 3 - 1 = 2 ;
    Different block {4,2} , Max element - Min element = 4 - 2 = 2 ;

Find the maximum block of the array after ful-fill the above conditions.

Input

  • First Line T,(1 ≤ T ≤ 50) the number of test cases.
  • In each test case,first line contain an integer N, (2 ≤ N ≤ 30), - length of the array.
  • Second line, an array A[], ( 1 ≤ A[] ≤ \(10^5\)) with exactly N elements.

Output

In each test case, print the maximum block of the array.

Sample

Input Output
3
6
8 3 7 3 8 7 
4
1 4 3 2
4
7 1 3 8 
3
2
1

First test case:

Information

ID
1162
Difficulty
9
Category
(None)
Tags
(None)
# Submissions
27
Accepted
1
Accepted Ratio
4%
Uploaded By

Related

In following contests:

Brain Booster #8