let rec tabulate n f = 
  let rec loop acc m =
    if m < n then loop (f m :: acc) (m + 1)
    else List.rev acc in
  loop [] 0

let () =
  let n, l = Scanf.scanf "%d %d\n" (fun n l -> n, l) in
  let ss = tabulate n (fun _ -> Scanf.scanf "%s\n" (fun s -> s)) in
  List.sort compare ss
  |> List.fold_left ( ^ ) ""
  |> print_endline
