This page is still under construction.

Parts of this page are still being built. What you see may change.

Silent Auction

Interview

Time limit1sMemory limit1024 MB

Summary
Given bids in the order they were placed, print the name of the highest bidder, breaking ties in favor of the earliest bid.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

A charity is having a silent auction where people place bids on a prize without knowing anyone else's bid. Each bid includes a person's name and the amount of their bid. After the silent auction is over, the winner is the person who has placed the highest bid. If there is a tie, the person whose bid was placed first wins. Your job is to determine the winner of the silent auction.

Input

The first line of input contains a positive integer NN, where 1≤N≤1001 \le N \le 100, representing the number of bids collected at the silent auction. Each of the next NN pairs of lines contains a person's name on one line, and the amount of their bid, in dollars, on the next line. Each bid is a positive integer less than 2000. The order of the input is the order in which bids were placed.

Output

Output the name of the person who has won the silent auction.

Examples2

  1. Example 1

    Input
    3
    Ahmed
    300
    Suzanne
    500
    Ivona
    450
    
    Expected output
    Suzanne
    
  2. Example 2

    Input
    2
    Ijeoma
    20
    Goor
    20
    
    Expected output
    Ijeoma