Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 3486
Judge Internal Error

Time Limit: 2 Seconds      Memory Limit: 65536 KB

The online judge system developed by Zhejiang University ACM/ICPC team (that is the system used during this contest) is designed to be robust. It can execute all kinds of user-submitted programs, including unsafe or malicious ones, and remain working and stable. However, it does report mysterious "Judge Internal Error" ("JIE" in short), occasionally.

JIE happens due to various reasons, such as crashes of special judge programs, poor network conditions, incredible large test data, extremely high system load, failures of hard disks, bugs of online judge system, cosmic radiation and so on. In our experience, real world JIE often reflects one or more problematic problems. Every time JIE happens, the corresponding problem ID is written to a special system log. Given the system log, your task is to find out the ID of the most problematic problem.

Input

The first line contains an integer T (T ≈ 10), the number of test cases. The following are test cases, separated by one blank line.

For each test case, the first line contains an integer N (1 ≤ N ≤ 1000), the size of system log. Following N lines, each line contains an integer Pi (1001 ≤ Pi ≤ 9999), which is the problem ID causing JIE.

Output

For each test case, output one integer in one line, which is the ID of the most problematic problem (that is, this ID occurs the most frequently in the log). When multiple IDs occur with a same frequency, prefer the largest ID.

Sample Input

2
4
1001
1003
1003
1002

2
1001
1003

Sample Output

1003
1003

Author: WU, Jun
Contest: The 11th Zhejiang University Programming Contest
Submit    Status