Bigrams
Description:
A bigram in a string is a pair of adjacent characters. For example, the string helloello contains 8 bigrams: he, el, ll, lo, oe, el, ll, lo.
Monocarp has cards with letters: cards with the letter a, cards with the letter b, ..., cards with the -th letter of the Latin alphabet. He wants to make a string from these cards, using each card exactly once. The resulting string must contain at least two equal bigrams. The order of characters in each bigram matters; for example, the string aba does not have two equal bigrams.
Determine whether it is possible to make a string that satisfies these requirements.
Input The first line contains one integer () — the number of test cases.
Each test case consists of two lines:
- the first line contains one integer ();
- the second line contains integers (), where is the number of cards with the -th letter of the Latin alphabet.
Output For each test case, output "YES" if it is possible to construct a string satisfying the condition, or "NO" otherwise.