#C4845. Book Partition Problem

    ID: 48428 Type: Default 1000ms 256MiB

Book Partition Problem

Book Partition Problem

In this problem, you are given a number N representing books numbered from 1 to N. Your task is to determine whether these books can be partitioned into two groups such that the sum of the numbers in both groups is equal.

Mathematically, the sum of the first N natural numbers is $$\frac{N \times (N+1)}{2}$$. For an equal partition to exist, this sum must be even. It turns out that a necessary and sufficient condition is that $$N \times (N+1) \equiv 0 \pmod{4}$$.

Implement a function that outputs "YES" if the partition is possible and "NO" otherwise.

inputFormat

The first line of input contains a single integer T (T ≥ 1) representing the number of test cases. Each of the next T lines contains an integer N (1 ≤ N ≤ 10^12), which denotes the number of books.

outputFormat

For each test case, output a single line containing "YES" if the books can be partitioned into two groups with equal sum, or "NO" otherwise.## sample

3
4
5
3
YES

NO YES

</p>