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 Fortran (gfortran v4.8.4) (judge verdict: Accepted)

program test03_2
 implicit none
 integer N
 character(len=10),allocatable :: S(:)
 character(len=10),allocatable :: Smax(:)
 integer,allocatable :: Sk(:)
 integer :: kaisuu=1, maxkaisuu=0
 integer i, ii
 integer :: j=1
 integer :: yatta=0

 read *, N
 allocate(S(N))
 allocate(Sk(N))
 allocate(Smax(N))
 do i=1,N
  read *, S(i)
! S(i)=trim(S(i))
 end do

Smax='a'
Sk=1

 call quicksort1(S,1,N)

 do i=2,N
  if (S(i)==S(i-1)) then
   Sk(i)=Sk(i-1)+1
!print *,i, S(i) ,Sk(i), 'yes'
  else
   Sk(i)=1
!print *,i, S(i) ,Sk(i), 'no'
  end if
 !print *,i, S(i) ,Sk(i)
 end do

 yatta=MAXVAL(Sk) 
!print *, 'yatta=',yatta

 print *,''
 do i=1,N
  if ( Sk(i) == yatta ) then
   print '(A)', trim(S(i))
  end if
 end do

!print *,''
!print '(A)', S(1)


contains
recursive subroutine quicksort1(a, first, last)
  implicit none
   character(len=10),intent(inout)::a(*)
   integer,intent(in)::first,last

   character(len=10)::x,t
   integer::i,j

   x = a((first+last)/2)
   i = first
   j = last
   do 
     do while (a(i) < x)
       i=i+1
     end do
     do while (x < a(j))
       j=j-1
     end do
     if (i >= j) exit
      t = a(i)
      a(i) = a(j)
      a(j) = t
      i=i+1
      j=j-1
   end do
   if (first < i-1) call quicksort1(a, first, i-1)
   if (j+1 < last)  call quicksort1(a, j+1, last)
 return
end subroutine quicksort1

endprogram test03_2