All submissions for this problem are available.
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a score log of a football match between two teams. Every time when one of the teams scored a goal, the name of that team was written in the score log on a separate line.
At the end of the match, the team that scored strictly more goals than the other team wins the match. If both teams scored an equal number of goals, the match ends in a tie. Determine the name of the winning team or that the match ended in a tie.
- The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains a single integer n denoting the number of records in the score log (the total number of goals scored during the match).
- Each of the following n lines contains a string s denoting the name of the team that scored a goal.
For each test case, print a single line containing one string — the name of the winning team or "Draw" (without quotes) in case of a tie.
- 1 ≤ T ≤ 105
- 0 ≤ n ≤ 105
- 1 ≤ |s| ≤ 20
- s consists only of lowercase English letters
- sum of n over all test cases ≤ 105
- for each test case, there are at most two different team names
Input: 2 4 ab bc bc ab 3 xxx yyy yyy Output: Draw yyy
|Tags||cakewalk, chemthan, chemthan, cook89, likecs, looping|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.