CF2014B.Robin Hood and the Major Oak

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Robin Hood and the Major Oak

In Sherwood, the trees are our shelter, and we are all children of the forest.

The Major Oak in Sherwood is known for its majestic foliage, which provided shelter to Robin Hood and his band of merry men and women.

The Major Oak grows iii^i new leaves in the ii-th year. It starts with 11 leaf in year 11.

Leaves last for kk years on the tree. In other words, leaves grown in year ii last between years ii and i+k1i+k-1 inclusive.

Robin considers even numbers lucky. Help Robin determine whether the Major Oak will have an even number of leaves in year nn.

Input

The first line of the input contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases.

Each test case consists of two integers nn, kk (1n1091 \le n \le 10^9, 1kn1 \le k \le n) — the requested year and the number of years during which the leaves remain.

Output

For each test case, output one line, "YES" if in year nn the Major Oak will have an even number of leaves and "NO" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Note

In the first test case, there is only 11 leaf.

In the second test case, k=1k=1, so in the 22-nd year there will be 22=42^2=4 leaves.

In the third test case, k=2k=2, so in the 22-nd year there will be 1+22=51+2^2=5 leaves.

In the fourth test case, k=2k=2, so in the 33-rd year there will be 22+33=4+27=312^2 + 3^3 = 4 + 27 = 31 leaves.

Samples

5
1 1
2 1
2 2
3 2
4 4
NO
YES
NO
NO
YES

在线编程 IDE

建议全屏模式获得最佳体验