Imports System.Collections.Generic
Imports System
Imports System.Linq
Module C
    Sub Main(ByVal args() As String)
        Dim n As Integer = Integer.Parse(Console.ReadLine())
        Dim arr(n - 1) As String
        Dim i, maxcnt As Integer
        Dim dict As New Dictionary(Of String, Integer)
        maxcnt = 0
        For i = 0 To n - 1
            arr(i) = Console.ReadLine()
            If dict.ContainsKey(arr(i)) Then
                dict(arr(i)) += 1
            Else
                dict.Add(arr(i), 1)
            End If
            If maxcnt < dict(arr(i)) Then maxcnt = dict(arr(i))
        Next
        Dim list As New List(Of String)
        If maxcnt > 1 Then
            Dim kvp As KeyValuePair(Of String, Integer)
            For Each kvp In dict
                If kvp.Value = maxcnt Then list.Add(kvp.Key)
            Next
        Else
            list = New List(Of String)(dict.Keys)
        End If
        list.Sort()
        Dim item As String
        For Each item In list
            Console.WriteLine(item)
        Next
    End Sub
End Module