//优化
#pragma GCC optimize(2)
//C
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
//C++
//#include<unordered_map>
#include<algorithm>
#include<iostream>
#include<istream>
#include<iomanip>
#include<climits>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
//宏定义
#define N 1010
#define DoIdo main
//#define scanf scanf_s
#define it set<ll>::iterator
//定义+命名空间
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 998244353;
const ll INF = 1e18;
const int maxn = 1e6 + 10;
using namespace std;
//全局变量
//函数区
ll max(ll a, ll b) { return a > b ? a : b; }
ll min(ll a, ll b) { return a < b ? a : b; }
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
//主函数
int DoIdo() {
ios::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
int T;
cin >> T;
while (T--) {
ll a, b, x, y;
cin >> a >> b >> x >> y;
ll g = gcd(2 * a, 2 * b);
bool jg = 0;
if (x % g == 0 && y % g == 0) jg = 1;
if ((x + a) % g == 0 && (y + b) % g == 0) jg = 1;
if ((x + b) % g == 0 && (y + a) % g == 0) jg = 1;
if ((x + a + b) % g == 0 && (y + a + b) % g == 0) jg = 1;
if (jg) cout << "Y" << endl;
else cout << "N" << endl;
}
return 0;
}
//分割线---------------------------------QWQ
/*
*/