"use strict";
function main(input) {
  let n = parseInt(input[0]);
  
  let index = {};

  let max = 0;

  for(let i=1;i<n+1;i++){
    if(index[input[i]]===undefined){
      index[input[i]] = 1;
    }else{
      index[input[i]]++;
    }
    max = (index[input[i]] > max)?index[input[i]]:max;
  }

  let result = [];
  let i=0;
  for(let key in index){
    if(index[key]===max){
      result[i] = key;
      i++;
    }
  }

  result.sort();

  for(let i=0;i<result.length;i++){
    console.log(result[i]);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));