Football Championship
Time limit2sMemory limit1024 MB
Given the standings before the final match, find Vasya's team's rank if it wins, draws, or loses that match, with ties broken by name.
- Level
Easy2 of 10
- Topics
- Sorting, Implementation
- Solved
- No attempts yet
Problem
Vasya is a passionate football fan. He just learned that the match involving his favorite team will be the last one of the championship, and the results of all other matches will be known before it ends.
Vasya wants to calculate the final place of his team in the standings depending on the result of that match. The task is not very hard, but Vasya is afraid he will be too nervous to do it himself, so he asked you to write a program that computes it for him.
A winning team gets points, and a losing team gets . In case of a draw, both teams get point each.
Input
The first line contains a positive integer , the number of teams in the championship (). The second line contains the name of the team Vasya supports, and the third line contains the name of the opponent in the last match. The following lines describe the standings after all matches except the last one. Each line contains a team name and its number of points, separated by a space. All names consist of uppercase Latin letters and are at most twenty characters long.
Output
Print three integers separated by spaces: the place of Vasya's team if it wins the last match, if it draws, and if it loses, respectively. If two teams have equal points, the team with the lexicographically smaller name ranks higher.