Under construction

Still being built. Things may change

Go to Jinju! (Easy)

Interview

Time limit1sMemory limit512 MB

Summary
Given N transport options with destinations and fares, find the fare to jinju and count the options that cost more than it.
Level

Easy1 of 10

Topics
Implementation, Array
Solved
No attempts yet

Problem

This problem is the same as "Jinju Let's Go! (Hard)" except for the range of the input numbers.

Bosun, a Gyeongsang National University graduate worn out by life in Seoul, missed his college days and wanted to visit Jinju, where the university is. So Bosun went straight to the Seoul bus terminal to take a day trip to Jinju.

The Seoul terminal has NN transport options. Each option has a destination and a fare, and all destinations are different. The destination jinju is always among them, and it marks the option that goes to Jinju.

Bosun is tired and does not want to check all NN options. Bosun asks you to find the fare to Jinju and the number of options that cost more than it.

Input

The first line contains NN, the number of transport options at the Seoul terminal. (1≤N≤10001 \le N \le 1000)

Each of the next NN lines contains the destination DiD_i and the fare CiC_i of the ii-th option, separated by a space. DiD_i is a string of lowercase English letters with length from 1 to 15. Exactly one jj has Dj=D_j = jinju, and that option goes to Jinju. (1≤Ci≤10001 \le C_i \le 1000)

All numbers in the input are integers.

Output

The first line prints the fare of the option going to Jinju.

The second line prints the number of options that cost more than the option going to Jinju.

Examples1

  1. Example 1

    Input
    5
    changwon 100
    incheon 70
    jinju 90
    haenam 530
    gangneung 660
    
    Expected output
    90
    3