Exam Invigilator


Submit solution

Points: 1
Time limit: 1.5s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

GIHS has an upcoming practice exam session for its year 12 students. Mr Longbottom has been appointed as the only exam invigilator for the competitive programming mid-year examination.

Mr Longbottom expects that some of the students will cheat and collude together if given the opportunity, so he will try his best to stop this.

Unusually, the exam is setup so that all n students taking the competitive programming class are arranged in a single line. However, the position p of the students are not uniformly distributed.

In an effort to stop cheating, Mr Longbottom will position himself between the two students who are closest together in the exam hall.

Input

The first line contains one integer n (2 \leq n \leq 1000), representing the number of students.

The next line contains n integers, the position of each student p_i (0 \leq p_i \leq 10^5). Every position p is unique.

Output

Output the two student positions that Mr Longbottom should stand between to reduce the chance of cheating.

Ensure that the two positions are seperated by a space and the smaller position come before the larger position.

If there are multiple pairs of students that are seperated by the minimum distance, return the pair which contains the smallest seat position. In other words, in the exam hall, if there are multiple equal minimum distances, display the pair closests to seat position 0.

Example

Input 1
4
6 2 4 1
Output 1
1 2

Example 1

  • Students at positions 1 and 2 are a distance of 1 apart.
  • Students at positions 2 and 4 are a distance of 2 apart.
  • Students at positions 4 and 6 are a distance of 2 apart.

Therefore, return the first pair as they are only 1 apart.

Input 2
6
0 15 10 12 4 17
Output 2
10 12

Although 15 and 17 are also 2 units apart, 10 and 12 are the pair who appear closest to seat position 0.

Input 3
2
10 0
Output 3
0 10

Comments

There are no comments at the moment.