object Main extends App {
	val n = scala.io.StdIn.readInt
	val x = scala.io.StdIn.readLine.split(" ").map(_.toLong)

	val max = x.max
	val min = max/2

	val x2 = x.filter(_ != max)

	val y = x2.map(z => math.abs(z - min))
	val tp = y.min

	if(x2.contains(min + tp)){
		println(max + " " + (min+tp))
	}else{
		println(max + " " + (min-tp))
	}
}