Don't Be Last!#10544

Don't Be Last!

1 second
128 megabytes
Very easy

Farmer John owns dairy cows: Bessie, Elsie, Daisy, Gertie, Annabelle, Maggie, and Henrietta. He milks them every day and keeps detailed records of the amount of milk produced by each cow during every milking session. Not surprisingly, Farmer John highly values cows that produce large amounts of milk.

Cows, being lazy creatures, do not necessarily want to be responsible for producing too much milk. If it were up to them, each cow would be perfectly content to be the lowest-producing cow in the herd. However, they keep hearing Farmer John mention the phrase "farm to table" when talking with his human friends. Although they do not quite understand what this means, they suspect that being the cow that produces the least amount of milk may not be the best idea. Instead, they figure it is safer to be the cow producing the second-smallest amount of milk in the herd. Please help the cows determine which of them currently occupies this desirable position.

Input

Begins with a line containing the integer n~(1 \le n \le 100), the number of entries in Farmer John's milking log.

Each of the next lines contains the name of a cow (one of the seven cows listed above), followed by a positive integer (at most ) indicating the amount of milk produced by that cow during one milking session.

Any cow that does not appear in the log at all is assumed to have produced no milk.

Output

Print the name of the cow that produces the second-smallest total amount of milk. More precisely, let be the minimum total amount of milk produced by any cow. Output the name of the cow whose total production is the smallest among all cows that produce more than units of milk. If several cows tie for this designation, or if no cow has this designation (that is, if all cows have produced exactly units of milk), output "Tie".

Examples

In this example, Bessie, Elsie, and Daisy are tied for the minimum, each producing units of milk. The next-smallest total production is units, produced by Henrietta.

Example 1

Loading
Loading