#K91527. Team Competition Winner Determination
Team Competition Winner Determination
Team Competition Winner Determination
In this problem, you are given the scores of participants from two teams, Team P and Team Q, in multiple test cases. For each test case, you need to determine which team wins based on the sum of scores. If the total score of Team P is greater than that of Team Q, then the output should be "Team P"; if the total score of Team Q is greater than that of Team P, output "Team Q"; otherwise, if both totals are equal, output "Tie".
The mathematical criteria can be denoted as follows:
Your solution should read input from standard input and write the answer to standard output.
inputFormat
The input starts with an integer T denoting the number of test cases. Each test case is described in the following format:
- An integer N, representing the number of participants in each team.
- A line with N space-separated integers representing the scores of Team P.
- A line with N space-separated integers representing the scores of Team Q.
outputFormat
For each test case, output a single line containing the result: either "Team P", "Team Q", or "Tie", based on which team has the higher total score, or if the scores are equal.## sample
3
3
70 80 65
85 75 60
2
50 50
40 60
4
20 30 40 50
25 30 35 50
Team Q
Tie
Tie
</p>