open Printf
open Scanf

let id x = x

let solve n =
  let ht = Hashtbl.create n in
  let rec loop x =
    if x = 0 then ()
    else begin
        (let s = scanf "%s " id in
        try
          let v = Hashtbl.find ht s
          in Hashtbl.replace ht s (v + 1)
        with
          Not_found -> Hashtbl.add ht s 1);
        loop (x - 1)
      end in
  loop n;
  List.sort compare @@
    snd @@
      Hashtbl.fold (fun k v (ct, ls) ->
                    if v > ct then (v, [k])
                    else if v = ct then (ct, k::ls)
                    else (ct, ls)) ht (0, [])
    
let () =
  scanf "%d " solve |> List.iter @@ printf "%s\n"
