      module charaSort
      implicit none
      
      contains
      recursive function sort( s ) result( r )
        implicit none
        character(10),intent(in) :: s(:)
        character(10) :: r( size(s) )
        
        if( size(s)>1 )then
          r = [sort( pack(s, s<s(1)) ), &
               pack(s,s==s(1)), &
               sort( pack(s, s>s(1)) )]
        else
          r = s
        end if
      end function
      end module


      PROGRAM Poll
      use charaSort
      IMPLICIT NONE
      integer(16) :: n
      character(10),allocatable :: s(:)
      character(10),allocatable :: note1(:)
      integer(16) :: i,counter,piyo,c
      integer(16),allocatable :: note2(:)
      logical,allocatable :: flag(:)
      
      
      read*,n
      allocate( s(1:n) )
      allocate(note1(n),note2(n),flag(n))
      do i = 1,n
        read'(a)',s(i)
      end do
      
      
      counter = 1
      note1(1) = s(1)
      note2(:) = 0
      outer:do i = 2,n
        do c = 1,counter
          if( note1(c)==s(i) )then
            note2(c) = note2(c) + 1
            cycle
          end if
        end do
        counter = counter + 1
        note1(counter) = s(i)
      end do outer
      
      
      flag = note2==maxval(note2)
      piyo = count( flag )
      
      deallocate( note1 )
      allocate( note1(piyo) )
      
      note1 = pack( s,flag )
      note1 = sort( note1 )
      
      do i = 1,piyo
        print*,note1(i)
      end do
      
      END PROGRAM