#include using namespace std; #define int long long signed main(){ int TT; cin>>TT; set> s; s.insert({0,0}); s.insert({0,1}); s.insert({0,2}); s.insert({1,0}); while(TT--){ int N,M; cin>>N>>M; if(N%4 == 0 && M%2 == 0){ cout<