let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let a = read_line () |> split_string ~pattern:" " |> List.map int_of_string |> List.sort compare |> List.rev

let x = List.hd a
let y = List.map (fun i -> (Float.abs (float i -. float x /. 2.), i)) a |> List.sort compare |> List.hd |> snd

let () = Printf.printf "%d %d\n" x y