#K78557. Reduce List to Zero
Reduce List to Zero
Reduce List to Zero
You are given T test cases. In each test case, you are provided with an integer n and a list of n integers. Your task is to determine if it is possible to "reduce" the list to a single integer 0, which, as per the hidden operation, is equivalent to checking whether every number in the list is even.
In mathematical terms, for each integer \( x \) in the list, you need to verify that
\[
x \bmod 2 = 0
\]
If this condition holds for all numbers in the list, output YES
; otherwise, output NO
.
Input is to be read from standard input (stdin) and output should be written to standard output (stdout).
inputFormat
The first line contains an integer T, representing the number of test cases. For each test case, the first line contains an integer n, the number of elements in the list, followed by a line containing n space-separated integers.
outputFormat
For each test case, print YES
if all integers in the respective list are even (i.e. satisfy ( x \bmod 2 = 0 )) and NO
otherwise. Each output should be printed on a new line.## sample
3
2
4 4
3
2 4 6
4
1 5 7 9
YES
YES
NO
</p>