module M = Map.Make (struct type t = string let compare = compare end)

let () =
    let n = read_int () in
    let rec loop i map =
        if i = n then map else
            let s = read_line () in
            let map = M.add s (1 + try M.find s map with _ -> 0) map in
            loop (i + 1) map
    in
    let map = loop 0 M.empty in
    let (_, l) = M.fold (fun key v (mx, mxl) ->
        if v > mx then (v, [ key ]) else
            if v = mx then (v, key :: mxl) else (mx, mxl)) map (0, [])
    in
    List.sort compare l |> List.iter print_endline