#K85747. Most Popular Dish

    ID: 36710 Type: Default 1000ms 256MiB

Most Popular Dish

You are given a number of test cases. For each test case, you are provided with a list of dishes ordered in a restaurant. Your task is to identify the dish that was ordered the most number of times. In case of a tie, choose the dish that is lexicographically smallest.

Formally, for each test case, if a dish (d) appears (f_d) times, you need to select the dish (m) such that (f_m = \max{f_d}) and for any other dish (d) with (f_d = f_m), (m) is lexicographically smallest.

inputFormat

The first line of input contains an integer (T), the number of test cases. For each test case, the first line contains an integer (N), the number of orders. The second line contains (N) space-separated strings representing the names of the dishes ordered.

outputFormat

For each test case, output a single line containing the most popular dish. If there are multiple dishes with the highest frequency, output the one that is lexicographically smallest.## sample

1
1
burger
burger

</p>