Problem:
Score: 300 points

Problem Statement

We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.

Print all strings that are written on the most number of votes, in lexicographical order.

Constraints

1 \leq N \leq 2 \times 10^5

S_i (1 \leq i \leq N) are strings consisting of lowercase English letters.

The length of S_i (1 \leq i \leq N) is between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print all strings in question in lexicographical order.

Sample Input 1

7
beat
vet
beet
bed
vet
bet
beet

Sample Output 1

beet
vet

beet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.

Sample Input 2

8
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo

Sample Output 2

buffalo

Sample Input 3

7
bass
bass
kick
kick
bass
kick
kick

Sample Output 3

kick

Sample Input 4

4
ushi
tapu
nichia
kun

Sample Output 4

kun
nichia
tapu
ushi

Solution in Rust (1.15.1) (judge verdict: Accepted)

use std::collections::HashMap;

fn poll() -> Result<(), &'static str> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input)
        .map_err(|_| "input error")?;
    let n = input.trim_right().parse::<usize>()
        .map_err(|_| "parse error")?;

    let mut sn: HashMap<String, u32> = HashMap::with_capacity(n);

    for _ in 0..n {
        let mut input = String::new();
        std::io::stdin().read_line(&mut input)
            .map_err(|_| "input error")?;
        let input = input.trim_right().to_string();
        let num = sn.entry(input).or_insert(0);
        *num += 1;
    }

    let mut max = 0_u32;
    for v in sn.values() {
        if max < *v {
            max = *v;
        }
    }

    let mut snv:Vec<&String> = 
        sn.iter()
        .filter_map(
            |(k, v)|
            if *v == max {
                Some(k)
            }
            else
            {
                None
            }).collect();
    snv.sort();
    for s in snv {
        println!("{}", s);
    }
    Ok(())
}

fn main() {
    poll().unwrap();
}