Under construction

Still being built. Things may change

Arithmetic Progression

Time limit2sMemory limit512 MB

Summary
Given 2n numbers, pick n of them that form an arithmetic progression and print its first term and common difference.
Level

Medium6 of 10

Topics
Sorting, Math, Hash map
Solved
No attempts yet

Problem

One day Petya found a very important sequence of nn numbers. After a careful analysis, he determined that it is an arithmetic progression. So he would not forget it, he wrote its elements on nn cards.

Then an accident happened. Not knowing how important the sequence was, his brother Vovochka took nn more cards, wrote arbitrary numbers on them, and shuffled all 2n2n cards together.

Now Petya wants to restore the original sequence from these cards. It may be possible to do this in several ways, but Petya is satisfied with any nn numbers that form an arithmetic progression.

Petya cannot do this by hand, so he asked you for help.

Input

The first line contains an integer nn (1≤n≤100 0001 \le n \le 100\,000). The next line contains 2n2n integers whose absolute values do not exceed 10910^9, the numbers written on the cards, listed in arbitrary order. It is guaranteed that you can choose nn of them that form an arithmetic progression.

Output

Print a1a_1 and dd on the first line, the first element and the difference of the found arithmetic progression. If d=0d = 0, the number a1a_1 must appear among the given numbers nn times.

If there are several solutions, print any of them.

Examples1

  1. Example 1

    Input
    3
    8 7 1 5 4 3
    
    Expected output
    1 3