#B3742. Knockout Football Tournament Champion
Knockout Football Tournament Champion
Knockout Football Tournament Champion
A school is holding a football tournament with 16 teams, from which a champion will be determined. The teams are labeled A through P in order. The following bracket shows the \(\frac{1}{8}\) finals (i.e. the round of 16):
In each match, the team with a lexicographically smaller label is considered the home team, and the other team is the away team. A match score is given in the form of p-q
, where \(p\) is the number of goals scored by the home team and \(q\) by the away team. The team that scores more goals advances to the next round.
For example, consider matches with order numbers 1 and 2. If their scores are \(1-2\) and \(4-3\), then team B (from match 1, away team) and team C (from match 2, home team) will advance, and will face each other in match number 9 with team B as the home team (since \(B < C\)).
Following this knockout bracket, you are given 15 match scores in the order of the match numbers. Your task is to determine the champion team.
inputFormat
The input consists of 15 lines. Each line contains a score in the format p-q
, representing the score of a match in the tournament. The first 8 scores correspond to the round of 16, the next 4 to the quarterfinals, the following 2 to the semifinals, and the last one to the final.
outputFormat
Output the label of the champion team (a single uppercase letter from A to P).
sample
1-0
2-1
3-2
0-4
2-3
5-1
0-1
4-0
1-2
2-3
0-1
3-1
2-0
1-2
0-1
N