'use strict'

const Main = (input) => {
  const nr = input.split('\n')
  const N = parseInt(nr[0])
  let counts = {}
  let max = {name: [], value: 0}
  for (let i = 1; i < N + 1; i++) {
    const key = nr[i]
    counts[key] = (counts[key]) ? counts[key] + 1 : 1
    if (counts[key] > max.value) {
      max.name = [key]
      max.value = counts[key]
    } else if (counts[key] === max.value) {
      max.name.push(key)
    }
  }
  max.name = max.name.sort()
  for (let j = 0; j < max.name.length; j++) {
    console.log(max.name[j])
  }
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))
