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
  
  do i = 1, N
     read(*,*) S(i)
     if(i==1) then
        count(i)=count(i)+1
     else
        do j =1, i-1
           if(S(i)==S(j)) then
              count(j)=count(j)+1
           end if
        end do
        count(i)=count(i)+1
     end if
  end do

  m=0
  do i = 1, N
     if(count(i)==maxval(count)) then
        m=m+1
        a=i
     end if
  end do

  if(m==1) then
     write(*,*) S(a)
     stop
  end if
  allocate(k(m))

  j=1
  do i = 1, N
     if(count(i)==maxval(count)) then
        k(j)=S(i)
        j=j+1
     end if
  end do

  !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


  do i = 1, m
     write(*,*) k(i)
  end do

  deallocate(S,k)
  stop
 end program answer