Cracking the Safe
Secret agent Roger is trying to crack a safe containing evil Syrian chemical weapons. In order to crack the safe, Roger needs to insert a key into the safe. The key consists of four digits. Roger has received a list of possible keys from his informants that he needs to try out. Trying out the whole list will take too long, so Roger needs to find a way to reduce the list.
A valid key satisfies a certain condition, which we call the 24 condition. Four digits that satisfy the 24 condition can be manipulated using addition, subtraction, multiplication, division and parentheses, in such a way, that the end result equals 24.
For example, the key (4, 7, 8, 8) satisfies the 24 condition, because (7-8/8)*4 = 24. The key (1, 1, 2, 4) does not satisfy the 24 condition, nor does (1, 1, 1, 1). These keys cannot possibly be the valid key and do not need to be tried.
Write a program that takes the list of possible keys and outputs for each key whether it satisfies the 24 condition or not.
Input
On the first line one positive number: the number of test cases, at most 100. After that per test case: one line with four space-separated integers a, b, c, d (1 ≤ a, b, c, d ≤ 9): a possible key.
Output
Per test case: one line with either "YES" or "NO", indicating whether the key satisfies the 24 condition or not.