program poll
  implicit none
  integer :: n, i, a(200000) = 0, m
  character(10) :: s(200000)
  read(*,*) n
  do i = 1, n
    read(*,*) s(i)
  end do
  call quick_sort(s(1:n))
  a(1) = 1
  do i = 2, n
    if (s(i) == s(i-1)) then
      a(i) = a(i-1)+1
    else
      a(i) = 1
    end if
  end do
  m = maxval(a(1:n))
  do i = 1, n
    if (a(i) == m) write(*,'(a)') trim(s(i))
  end do
contains
  subroutine swap(a,b)
    character(10), intent(inout) :: a, b
    character(10) :: c
    c = a
    a = b
    b = c
  end
  recursive subroutine quick_sort(a)
    character(10), intent(inout) :: a(:)
    integer :: n, l, r
    character(10) :: p
    n = size(a)
    l = 1
    r = n
    p = a((n+1)/2)
    do
      do while (a(l) < p)
        l = l+1
      end do
      do while (a(r) > p)
        r = r-1
      end do
      if (l >= r) exit
      call swap(a(l),a(r))
      l = l+1
      r = r-1
    end do
    if (l-1 > 1) call quick_sort(a(1:l-1))
    if (n > r+1) call quick_sort(a(r+1:n))
  end
end program poll