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 (GNU Fortran 9.2.1) (judge verdict: Runtime Error)

program answer
  implicit none
  integer :: i, j, N, m, a
  character(len=10), allocatable :: S(:), k(:)
  character(len=10) :: temp
  integer, allocatable :: count(:)

  read(*,*) N
  allocate(S(N))
  allocate(count(N))
  count=0
 
  !sort
  !do i = 1, m-1
  !   do j = i+1, m
  !      if(k(i)>k(j)) then
  !         temp=k(i)
  !         k(i)=k(j)
  !         k(j)=temp
  !      end if
  !   end do
  !end do

  call heapsort(n,k)
  j=0
  do i = 1, n-1
     if(k(i)/=k(i+1)) then
        count(i)=i-j
        j=i
     end if
  end do

  do i = 1, n-1
     if(count(i)==maxval(count)) then
        write(*,*) k(i)
     end if
  end do

  deallocate(S,k,count)
  stop
  contains

  subroutine heapsort(n,array)
  implicit none
  integer, intent(in) :: n
  character(len=10) :: array(1:n)
 
  integer ::i,g,j,l
  character(len=10) :: t

  if(n.le.0)then
     write(6,*)"Error, at heapsort"; stop
  endif

  l=n/2+1
  g=n
  do while(g.ne.1)
     if(l.gt.1)then
        l=l-1
        t=array(L)
     else
        t=array(g)
        array(g)=array(1)
        g=g-1
        if(g.eq.1) then
           array(1)=t
           exit
        end if
     end if
     i=l
     j=l+l
     do while(j.le.g)
        if(j.lt.g)then
           if(array(j).lt.array(j+1)) then
              j=j+1
           end if
        endif
        if (t.lt.array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=g+1
        end if
     end do
     array(i)=t
  end do

  return
end subroutine heapsort

 end program answer