Drop links or images here to add them to the editor.

King of Pirates ⭐⭐⭐

Guffy dreams of becoming the King of Pirates. To do that, he must choose which torrent to download first from a list published by the ICPC.

Each torrent i has:

Guffy wants the torrent with the highest number of seeds. If there is a tie, he chooses the one with the lowest number of peers.

Input

  1. An integer N (0 < N <= 10^4), the number of torrents.
  2. Then N lines, each with two integers S_i and P_i (0 <= S_i <= 10^4, 0 <= P_i <= 10^4).

Torrents are numbered from 1 to N in input order.

Output

Print one integer: the index of the torrent Guffy should download first.

If there is still a tie (same seeds and same peers), any tied index is valid.

Example

Input:

3
2 5
4 0
5 10

Output:

3