#K1156. Determine the Competition Winner

    ID: 23495 Type: Default 1000ms 256MiB

Determine the Competition Winner

Determine the Competition Winner

In a coding competition, two participants, Alice and Bob, solve a set of problems. For each participant, their scores on problems are given as pairs of a problem ID and an integer score. The winner is determined by the total score, which is the sum of scores for all problems. Formally, for each participant the total score is given by \(\sum_{i=1}^{n} score_i\). If Alice's total score is greater than Bob's, print Alice wins!; if Bob's score is higher, print Bob wins!; otherwise, print It's a tie!.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains an integer n, representing the number of problems solved by Alice.
  2. The next n lines each contain a problem ID (a string without spaces) and an integer representing the score for that problem.
  3. The following line contains an integer m, representing the number of problems solved by Bob.
  4. The next m lines each contain a problem ID and an integer score for Bob.

Note: If n or m is 0, then no problem lines follow for that participant.

outputFormat

Output a single line to standard output (stdout) containing the result: either "Alice wins!", "Bob wins!", or "It's a tie!".## sample

3
problem1 10
problem2 20
problem3 15
2
problem2 25
problem3 10
Alice wins!