#include <bits/stdc++.h>
#define ll long long
using namespace std;


int main()
{
    int t; cin >> t; 
    while(t--)
    {
        int n, m; cin >> n >> m; 
        if(n == 0 && m % 2)
            cout << "NO"; 
        else if(n % 2 && m == 0)
            cout << "NO"; 
        else if(n % 2 == 0)
            cout << "YES";
        else 
            cout << "NO"; 
        cout << "\n";
    }
}
