function comp(a, b) {
  const len = a.length > b.length ? a.length : b.length

  for (let i = 0; i < len; i++) {
    if (a[i] === undefined) return -1
    if (b[i] === undefined) return 1
    if (a[i] < b[i]) {
      return -1
    } else if (a[i] > b[i]) {
      return 1
    }
  }
}

function main(input) {
  const inputs =input.split('\n')
  const [N] = inputs[0].split(' ').map(Number)
  const S = inputs.slice(1)

  // 辞書順に
  // 最も多く出たものを出力
  S.sort(comp)
  // console.log(S)
  let count = {}
  let max = 0
  for (let i = 0; i < N; i++) {
    if (count[S[i]] === undefined) count[S[i]] = 0
    count[S[i]] += 1
    if (max < count[S[i]]) max = count[S[i]]
  }
  // console.log(count, max)
  for (let i = 0; i < N; i++) {
    // console.log(count[S[i]], max)
    if (count[S[i]] === max) {
      console.log(S[i])
      count[S[i]] = -1
    }
  }
}

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