1535Judge Internal Error

1535   Judge Internal Error

题目描述

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.

输入格式:

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.

输出格式:

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.

输入样例 复制
2
4
1001
1003
1003
1002
2
1001
1003
输出样例 复制
1003
1003

说明

57
130
通过提交
时空限制1000ms/128mb
题目来源
评测方式在线评测
题目类型
难        度