n = gets.to_i
arr = gets.chomp.split.map(&:to_i).sort
stop = false
for i in 0..(n-2)
    for j in (i+1)..(n-1)
        if (arr[j] - arr[i]) % (n - 1) == 0
            puts "#{arr[i]} #{arr[j]}"
            stop = true
        end
        break if stop
    end
    break if stop
end
