'use strict'

// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
  let line1 = input[0].split(" ");
  let n = line1[0];

  let map = new Map();
  let max = 0;
  let ans = [];

  for(let i=0; i<n; i++) {
    let s = input[i+1];
    if(!map.has(s)) {
      map.set(s,0);
    }
    else {
      let count = map.get(s)+1;
      max = Math.max(count, max);
      map.set(s, count );
    }
  }

  let m = 0;
  for (let [key, value] of map) {
    if(value !== max) {
      map.delete(key);
    } else {
      ans.push(key);
    }
  }

  ans.sort();
  for(let i=0; i< ans.length; i++) {
    console.log(ans[i]);
  }

}

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