#C13464. Highest Scorer

    ID: 43005 Type: Default 1000ms 256MiB

Highest Scorer

Highest Scorer

You are given a list of entries, where each entry consists of a name (a string) and a score (an integer). Your task is to determine the name associated with the highest score. In case there are multiple entries with the same highest score, you should choose the one that appears first in the input order. If the list is empty, output None.

The problem can be formulated mathematically as follows:

Given a sequence of entries \((n_i, s_i)\) for \(i = 1, 2, \dots, m\), find \(n_k\) such that \(s_k = \max_{1 \leq i \leq m} s_i\) and if there exists another \(j < k\) with \(s_j = s_k\), then \(k\) is the smallest index with the maximum score.

inputFormat

The input is read from stdin and has the following format:

  1. The first line contains a single integer \(n\) representing the number of entries.
  2. Then follow \(n\) lines, each containing a name (string) and a score (integer) separated by space.

outputFormat

Output the name (to stdout) of the entry with the highest score. If no entries are provided (i.e. \(n = 0\)), output None.

## sample
1
Alice 45
Alice