One Legend for Multiple Subplots
Halewood Reporting tracks two product lines, A and B, over a run of periods, drawing each in its own panel. A key repeated inside both panels wastes space and invites a reader to think the two keys might say different things, so the report gathers the entries from both panels into a single key for the whole figure. The caption states which line finished ahead — the position at the last period, not the run as a whole.
Task: Print A or B, whichever line has the higher value at the final period. If the two finish exactly level, print B.
Input
The first line holds an integer n, the number of periods. Each of the next n lines holds three fields separated by single spaces: the period label as a whole number, then line A's value for that period, then line B's. Periods arrive in order, so the last line is the final period. n is at least 1.
Output
One line holding a single capital letter, A or B.
Example:
Input:
3
1 10 20
2 15 18
3 20 15
Output:
A
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in