object Main extends App {

  import scala.io.StdIn._

  val n = readLine.trim.toInt
  val memo = Array.tabulate(1000){_ ⇒ 0}
  val num = readLine.trim.split(' ').map(_.toInt)
  num.find{it ⇒
    if (memo(it % (n - 1)) == 0) {
      memo(it % (n - 1)) = it
      false
    }else {
      true
    }
  } match{
    case Some(a) ⇒ println(s"${memo(a % (n - 1))} $a")
    case _ ⇒
  }
}
