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 C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;

namespace ConsoleTest
{
    static class Program
    {
        class Solver
        {

            public void Solve()
            {
                var n = Int();
                var s = new string[n];
                var d = new Dictionary<string, int>();
                for (int i = 0; i < n; ++i)
                {
                    var key = Console.ReadLine();
                    if (d.ContainsKey(key)) d[key]++;
                    else d[key] = 1;
                }
                var max = d.Max(kv=>kv.Value);
                var r = new List<string>();
                foreach (var item in d)
                {
                    if (item.Value == max) r.Add(item.Key);
                }
                var rs = r.OrderBy(str => str, StringComparer.Ordinal);
                //r.Sort(StringComparer.Ordinal);
                //r.Reverse();
                //r.Reverse();
                var sb = new StringBuilder();
                foreach (var item in rs)
                {
                    sb.AppendLine(item);
                }
                Console.WriteLine(sb.ToString());
            }



            public int Int()
            {
                return int.Parse(Console.ReadLine());
            }
            public int[] Ints()
            {
                return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            }
            public long[] Longs()
            {
                return Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
            }
            public int[][] MultiInts(int num)
            {
                var result = new int[num][];
                for (int i = 0; i < num; ++i)
                {
                    result[i] = Ints();
                }
                return result;
            }
            public T[] MultiItems<T>(int num, Func<string, T> parser)
            {
                var result = new T[num];
                for (int i = 0; i < num; ++i)
                {
                    result[i] = parser(Console.ReadLine());
                }
                return result;
            }
        }
        
  

        static void Main(string[] args)
        {
            new Solver().Solve();
        }
    }
    struct ModInt
    {
        const int MOD = 1000000007;
        long Data;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ModInt(long data) { if ((Data = data % MOD) < 0) Data += MOD; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static implicit operator long(ModInt modInt) => modInt.Data;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static implicit operator ModInt(long val) => new ModInt(val);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt operator +(ModInt a, ModInt b)
        {
            long res = a.Data + b.Data;
            return new ModInt() { Data = res >= MOD ? res - MOD : res };
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt operator +(ModInt a, long b) => a.Data + b;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt operator -(ModInt a, ModInt b)
        {
            long res = a.Data - b.Data;
            return new ModInt() { Data = res < 0 ? res + MOD : res };
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt operator -(ModInt a, long b) => a.Data - b;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % MOD };
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt operator /(ModInt a, ModInt b) => a.Data * GetInverse(b);

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override string ToString() => Data.ToString();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static long GetInverse(long a)
        {
            long div;
            long p = MOD;
            long x1 = 1, y1 = 0, x2 = 0, y2 = 1;
            while (true)
            {
                if (p == 1) return x2;
                div = a / p;
                x1 -= x2 * div;
                y1 -= y2 * div;
                a %= p;
                if (a == 1) return x1;
                div = p / a;
                x2 -= x1 * div;
                y2 -= y1 * div;
                p %= a;
            }
        }
    }

}