function Main(input) {
	input = input.trim();
  var list = input.split("\n")[1].split(" ").map((list)=>Number(list)).sort(function(a,b){return b - a;});
  var max = list.shift();
  if(list.length == 1){
     console.log(max + " " + list[0]);
  }else{
    var kijun = Math.floor(max / 2);
    var output = max;
    var last = max;
    for(var i = 0; i < list.length; i++){
      if(last > Math.abs(kijun - list[i])){
         output = list[i];
        last = Math.abs(kijun - list[i]);
      }
    }
    console.log(max + " " + output);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
