Omar left his home for 14 years because of the war in Syria.
He has a favorite array $$$a$$$ of size $$$n$$$.
Before he left, he used to do the following process:
After returning home, he found that his array was lost due to the destruction. However, he managed to find the paper where he had written all the medians.
But the paper is damaged — some numbers may be incorrect. Omar is not sure if the information on the paper is valid or not.
Given the size $$$n$$$ and a multiset of $$$\binom{n}{3}$$$ numbers (the numbers written on the paper), your task is to determine whether there exists any array $$$a$$$ of size $$$n$$$ such that the multiset of medians of all triples of indices matches exactly the given multiset.
Here $$$\binom{n}{3}$$$ denotes the binomial coefficient, which is the number of triples of distinct indices from $$$n$$$ indices:
$$$$$$ \binom{n}{3} = \frac{n(n-1)(n-2)}{6} $$$$$$
For example, $$$\binom{4}{3} = 4$$$, $$$\binom{5}{3} = 10$$$, and $$$\binom{6}{3} = 20$$$.
The first line contains a single integer $$$n$$$ ($$$3 \le n \le 100$$$).
The second line contains $$$\binom{n}{3}$$$ integers $$$b_1, b_2, \ldots, b_{\binom{n}{3}}$$$ ($$$1 \le b_i \le 10^9$$$) — the numbers written on the paper.
print "YES" if there exists an array $$$a$$$ of length $$$n$$$ that produces exactly this multiset of medians, otherwise print "NO".
47 3 3 7
YES
51 2 3 4 5 6 7 8 9 10
NO
| Название |
|---|


