"use strict"
function Main(input) {
  input = input.trim().split('\n');
  const N = Number(input[0]);
  const S = input.slice(1, N+1);

  let arr = {};
  let max = 0;
  for(let i=0; i<N; i++){
    arr[S[i]] = arr[S[i]] ? arr[S[i]] + 1 : 1;
    if(arr[S[i]] > max) max = arr[S[i]];
  }

  console.log(arr);
  let keys = Object.keys(arr);
  let ret = [];
  for(let i=0; i<N; i++){
    if(arr[keys[i]] === max) ret.push(keys[i]);
  }

  console.log(ret.sort().join('\n'));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));