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: Time Limit Exceeded)

using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Io.Read<int>();
            var SList = Io.ReadRepeat(N);

            var dic = new Dictionary<string, int>();
            foreach (var s in SList)
            {
                int count;
                if (!dic.TryGetValue(s, out count))
                {
                    dic.Add(s, 0);
                }

                dic[s] = count + 1;
            }

            var maxCount = 0;
            var maxSList = new List<string>();
            foreach (var d in dic)
            {
                if (maxCount < d.Value)
                {
                    maxCount = d.Value;
                    maxSList.Clear();
                    maxSList.Add(d.Key);
                }
                else if (maxCount == d.Value)
                {
                    maxSList.Add(d.Key);
                }
            }

            maxSList.Sort();

            foreach (var d in maxSList)
            {
                Io.Write(d);
            }
        }

        static class Permutation
        {
            private static void Search<T>(List<T[]> perms, Stack<T> stack, T[] a)
            {
                int N = a.Length;
                if (N == 0)
                {
                    perms.Add(stack.Reverse().ToArray());
                }
                else
                {
                    var b = new T[N - 1];
                    Array.Copy(a, 1, b, 0, N - 1);
                    for (int i = 0; i < a.Length; ++i)
                    {
                        stack.Push(a[i]);
                        Search(perms, stack, b);
                        if (i < b.Length) { b[i] = a[i]; }
                        stack.Pop();
                    }
                }
            }
            public static IEnumerable<T[]> All<T>(IEnumerable<T> src)
            {
                var perms = new List<T[]>();
                Search(perms, new Stack<T>(), src.ToArray());
                return perms;
            }
        }

        static int NumberOfDigits(long x)
        {
            if (x < 10) return 1;

            var result = 0;
            while (x > 0)
            {
                result++;
                x /= 10;
            }

            return result;
        }

        static int SumOfDigits(int x)
        {
            var sum = 0;
            while (x > 0)
            {
                sum += x % 10;
                x /= 10;
            }

            return sum;
        }

        class Io
        {
            public static string Read()
            {
                return Console.ReadLine();
            }

            public static IEnumerable<string> ReadRepeat(int count)
            {
                return Enumerable.Range(0, count).Select(_ => Read());
            }

            public static T Read<T>()
            {
                return (T)Convert.ChangeType(Read(), typeof(T));
            }

            public static IEnumerable<T> ReadRepeat<T>(int count)
            {
                return Enumerable.Range(0, count).Select(_ => Read<T>());
            }

            public static string[] ReadList(char devide = ' ')
            {
                return Read().Split(devide);
            }

            public static T[] ReadList<T>(char devide = ' ')
            {
                return ReadList(devide)
                    .Select(s => (T)Convert.ChangeType(s, typeof(T)))
                    .ToArray();
            }

            public static IEnumerable<string[]> ReadListRepeat(int count, char devide = ' ')
            {
                return Enumerable.Range(0, count).Select(_ => ReadList(devide));
            }

            public static IEnumerable<T[]> ReadListRepeat<T>(int count, char devide = ' ')
            {
                return Enumerable.Range(0, count).Select(_ => ReadList<T>(devide));
            }

            public static void Write(string value)
            {
                Console.WriteLine(value);
            }
        }
    }
}