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

module ch
  implicit none
  type char
     character(10)      :: chara
  end type char
  type(char),allocatable :: namec(:)
  type(char),allocatable :: namecmax(:)
end module ch
program main
   
  use ch, only : namec, namecmax

  implicit none
  integer :: n
  integer, allocatable :: s(:)
  integer :: i,j,k, nmax
  
  read(*,*) n

  allocate( s(n) )
  allocate( namec(n) )

  do i = 1, n
    read(*,*) namec(i)%chara
  end do

  call quicksort1( 1, n ) 

  j = 1 
  do i = 1, n-1
    if( namec(i)%chara == namec(i+1)%chara ) then
      j = j + 1
      s(i) = j
    else
      j = 1 
      s(i) = j
    end if 
  end do
  s(n) = 1

  do i = 1, n
    if( s(i) == maxval( s ) ) then
      print*,namec(i)%chara
    end if
  end do

end program main
recursive subroutine quicksort1( first, last )

  use ch, only : namec, namecmax

  implicit none
  integer,intent(in)::first,last
  !
  ! Original
  ! https://gist.github.com/t-nissie/479f0f16966925fa29ea
  !
  character(100)::x,t
  integer::i,j

  x = namec((first+last)/2)%chara
  i = first
  j = last
  do
     do while ( LGT( x, namec(i)%chara ) )
        i=i+1
     end do
     do while ( LGT( namec(j)%chara, x ) )
        j=j-1
     end do
     if (i >= j) exit
     t = namec(i)%chara
     namec(i)%chara = namec(j)%chara
     namec(j)%chara = t
     i=i+1
     j=j-1
  end do
  if (first < i-1) call quicksort1( first, i-1  )
  if (j+1 < last)  call quicksort1( j+1  , last )

  return

end subroutine quicksort1
recursive subroutine quicksort2( first, last )

  use ch, only : namecmax 

  implicit none
  integer,intent(in)::first,last
  !
  ! Original
  ! https://gist.github.com/t-nissie/479f0f16966925fa29ea
  !
  character(10)::x,t
  integer::i,j

  x = namecmax((first+last)/2)%chara
  i = first
  j = last
  do
     do while ( LGT( x, namecmax(i)%chara ) )
        i=i+1
     end do
     do while ( LGT( namecmax(j)%chara, x ) )
        j=j-1
     end do
     if (i >= j) exit
     t = namecmax(i)%chara
     namecmax(i)%chara = namecmax(j)%chara
     namecmax(j)%chara = t
     i=i+1
     j=j-1
  end do
  if (first < i-1) call quicksort2( first, i-1  )
  if (j+1 < last)  call quicksort2( j+1  , last )

  return

end subroutine quicksort2