import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.typecons;

void main() {
  uint[string] table;

  auto n = readln.chomp.to!uint;
  foreach (i;0..n) {
    auto key = readln.chomp;
    if (auto p = key in table) {
      ++*p;
    } else {
      table[key] = 1;
    }
  }
  table.rehash;

  auto keys = table.keys;
  auto comp = (Tuple!(string, uint) a, Tuple!(string, uint) b) {
    if (a[1] == b[1]) {
      return a[0] < b[0];
    }
    return a[1] > b[1];
  };
  auto z = zip(keys, keys.map!((a) => table[a])).array.sort!(comp);

  auto m = z.front[1];
  foreach (e;z) {
    if (e[1] < m) {
      break;
    }
    writeln(e[0]);
  }
}
