Lazy Nobita

3.3

55 votes
Easy
Problem

Lazy Nobita wants to travel between two cities. He wants to go to a particular city ( City i ) such that he can reach one of the another cities ( City j ) by walking minimum distance from City i.

All the cities are located on positive x axis (including origin) and their co-ordinates are given to you. No two cities can lie on same co-ordinates.

Can you help Nobita to find such two cities (City i and City j) ?

Input

First line contains N denoting number of cities. Next line contains co-ordinates of all the cities separated by space.

Output

Print co-ordinates of two required pair of cities separated by space. If there exists multiple required pair of cities, then give the pair which have lowest co-ordinates (Left most pair on x axis).

Constrains

2 <= N <= 1,00,000
0 <= Co-ordinate of city <= 10,00,000

Setter : Pinal

Tester: Akshay Miterani

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

We see that cities {3,5}, {7,9} and {11,13} are the closest pair of cities among all the pair of cities. Since cities {3,5} are located left most compared to other two, it is the required pair of cities.

Editor Image

?