CODERE2 - Coder Express 2!!

no tags 

Meenamma was quite impressive with Rahul's skill. She take him to her city Kumban to meet her father. Her father Mr Durgeshwara was a pro coder and wants to marry his daughter to a person who is as good as him.

He gave Rahul a challenging problem to solve. The challenge was really a tough one and both Rahul and Meenamma was not able to get through it. The challenge was you have been given a list of numbers and you have to find the most frequent number in the list. If there are multiple numbers which are frequent you have to find the smallest one!! Help them so that their love story continues??

Input Specification:

First line contains an integer T (1 <= T <= 10) that represents the number of test cases. The following line contains the integer N (1 <= N <= 100000) specifying the total number of elements and the next line contains the N integers A1, A2, A3 ... An (1 <= Ai <= 10^9)

Output Specification:

For each test case, print only one line, the output of your program.

Sample input:

2
10
1 2 3 4 5 6 7 8 9 9
5
5 4 4 3 3

Sample Output:

9
3



Added by:Rajesh Kumar
Date:2013-09-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:AASF - ABV-IIITM PC-01-9-2013