P10835 『FLA - I』Up to the Clouds

Background

It has been a long time since Ryan, who lives in Hohhot, learned the operation XOR. Denote by $\oplus$ the Bitwise XOR operation. In C++, it is denoted by `^`. The XOR of non-negative integers $x$ and $y$ is the result of performing the following operation on each bit of their binary representation: - When $x$ and $y$ are different on this bit, the result is $1$ on this bit. - When $x$ and $y$ are the same on this bit, this result is $0$ on this bit. Denote by $(X)_{10}$ the decimal representation of $X$, and denote by $(Y)_2$ the binary representation of $Y$. For example, $(12)_{10}=(1100)_2$, $(10)_{10}=(1010)_2$, and then $(12)_{10} \oplus (10)_{10}=(1100)_2 \oplus (1010)_2=(0110)_2=(6)_{10}$. Flanksy, who lives in Yinchuan, tried to stump Ryan using this problem but failed. Now Flanksy wants to use this problem to stump you. Don't let his conspiracy succeed!

Description

Given **integers** $n$ and $m$, determine whether there is a sequence $a$ that satisfying the following constraints. The indices of the sequence elements in this question start from $1$. - The length of the sequence $a$ is $m$, and each entry of the sequence $a$ is a **positive integer**. - $a_1 \oplus a_2 \oplus \cdots \oplus a_m = n$, that is, the result of XORing all entries of the sequence $a$ is equal to $n$. - All the entries in $a$ are the same.

Input Format

**Each test consists of multiple test cases.** The first line contains an integer $T$ — the number of test cases. Then follows the description of the test cases. Each test case consists of one line. The only line of each test case contains two integers $n$ and $m$.

Output Format

For each test case, if there is a sequence $a$ that satisfies the restrictions, print `Yes`; otherwise, print `No`.

Explanation/Hint

**「Sample Explanation #1」** For the first test case, the sequence $a$ can be $[3,3,3]$, in which case $a_1 \oplus a_2 \oplus a_3 = 3 \oplus 3 \oplus 3 = 3$. For the second test case, the sequence $a$ can be $[2,2,2,2,2]$, in which case $a_1 \oplus a_2 \oplus a_3 \oplus a_4 \oplus a_5 = 2 \oplus 2 \oplus 2 \oplus 2 \oplus 2 = 2$. For the third and fourth test cases, it can be proved that there is no sequence that satisfies the restrictions. **「Constraints」** |Test Id|$T \leq$|$n \leq$|$m \leq$| |:-:|:-:|:-:|:-:| |$1 \sim 2$|$5$|$0$|$10^9$| |$3 \sim 4$|$5$|$10^9$|$3$| |$5$|$10^5$|$10^9$|$10^9$| Each test is worth $20$ points. For all tests, $1 \leq T \leq 10^5$, $0 \leq n \leq 10^9$, $2 \leq m \leq 10^9$.