SP16121 NITK06 - MODIFY SEQUENCE

Description

Suppose we have a sequence of non-negative integers, Namely a $ _{1} $ , a $ _{2} $ , ..., a $ _{n} $ . At each time we can choose one term a $ _{i} $ with 0 < i < n and we subtract 1 from both a $ _{i} $ and a $ _{i+1} $ . We wonder whether we can get a sequence of all zeros after several operations.

Input Format

The first line is the number of test cases T (0 < T

Output Format

If it can be modified into all zeros with several operations output “YES” in a single line, otherwise output “NO” instead.