Simple Problem - 1

4.7

3 votes
Easy, Very Easy
Problem

Piyush and Arpit decided to play a game. They have n disks (n is an even number). A single integer is written on each disk.

Before the game Piyush will choose an integer and after that Arpit will choose another integer (bigger than the number that Piyush chose). During the game each player takes all the disks with number he chose. For example, if Piyush chose number 5 before the game he will take all disks on which 5 is written and if Arpit chose number 10 before the game he will take all disks on which 10 is written.

The game is considered fair if Piyush and Arpit can take all n disks, and the number of disks each player gets is the same.

Determine whether Piyush and Arpit can choose integer numbers before the game so that the game is fair.

Input:
The first line contains a single integer n (2 ≤ n ≤ 100) — number of disks. It is guaranteed that n is an even number.

The following n lines contain a sequence of integers a1, a2, ..., an (one integer per line, 1 ≤ ai ≤ 100) — numbers written on the n disks.

Output:
If it is impossible for Piyush and Arpit to choose numbers in such a way that the game will be fair, print "NO" (without quotes) in the first line. In this case you should not print anything more.

In the other case print "YES" (without quotes) in the first line. In the second line print two distinct integers — number that Piyush should choose and the number that Arpit should choose to make the game fair. Only one solution is possible.
 

Examples:

Input 1:

4
11
27
27
11

Output 1:

YES
11 27

 

In the first example the game will be fair if, for example, Piyush chooses number 11, and Arpit chooses number 27. Then the will take all disks — Piyush will take disks 1 and 4, and Arpit will take disks 2 and 3. Thus, each of them will take exactly two disks.

Input 2:

2
6
6

Output 2:

NO

 In the second example fair game is impossible because the numbers written on the disks are equal, but the numbers that Piyush and Arpit should choose should be distinct.

Input 3:

6
10
20
30
20
10
20

Output 3:

NO

 In the third example it is impossible to take all disks. Piyush and Arpit can take at most five disks — for example, Piyush can choose number 10 and Arpit can choose number 20. But for the game to be fair it is necessary to take 6 disks.

Input 4:

6
1
1
2
2
3
3

Output 4:

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

Piyush chooses number 11, and Arpit chooses number 27. Then the will take all disks — Piyush will take disks 1 and 4, and Arpit will take disks 2 and 3. Thus, each of them will take exactly two disks.

Editor Image

?