Recently, Ignat heard a new word for him: “dualism”. Unfortunately, he misunderstood it completely, as he now believes that there is a dualism between two numbers if their sum is a prime number. No matter how much Vadim tried to explain to him that this is a profound property of philosophical theories, Ignat refused to believe it and stood his ground.
After another unsuccessful conversation, Vadim said goodbye to Ignat but forgot his wallet, which contained N banknotes. Ignat found this wallet and immediately notified Vadim about it, but he became curious about how much money was in the wallet. He was very surprised to see that there was an even number of banknotes, as this means that they can be paired up such that the sums of the values of the banknotes in each pair exhibit dualism! Or can they? Help Ignat answer this question.
Input
The first line contains an integer N — the number of banknotes in the wallet (2 ≤ N ≤ 500). It is guaranteed that N is even.
The second line contains N integers ci — the values of the banknotes (1 ≤ ci ≤ 106).
Output
Print “NO” if it is impossible to pair the banknotes as required. Otherwise, print “YES”, and in the next N / 2 lines, print two integers ai and bi — the pairings. The sum ai+bi must be prime, and the set of all ai and bi must match the set of all ci.
If there are multiple answers, print any of them.
Samples
input | output |
---|
8
6 2 4 5 2 3 1 5
| YES
5 2
3 2
5 6
1 4
|
2
1 3
| NO
|
Problem Author: Ignat Nigmatullin
Problem Source: Ural School Programming Contest 2023