#K91527. Team Competition Winner Determination

    ID: 37995 Type: Default 1000ms 256MiB

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:

$$\text{if }\sum_{i=1}^{N}P_i > \sum_{i=1}^{N}Q_i\text{ then Team P wins}, $$$$\text{if }\sum_{i=1}^{N}P_i < \sum_{i=1}^{N}Q_i\text{ then Team Q wins}, $$otherwise, it is a Tie.\text{otherwise, it is a Tie.}

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:

  1. An integer N, representing the number of participants in each team.
  2. A line with N space-separated integers representing the scores of Team P.
  3. 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>