#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;

ll gcd (ll a, ll b, ll & x, ll & y) {
	if (a == 0) {
		x = 0; y = 1;
		return b;
	}
	ll x1, y1;
	ll d = gcd (b % a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

bool find_any_solution (ll a, ll b, ll c, ll &x0, ll &y0, ll &g) {
	g = gcd (a, b, x0, y0);
	if (c % g != 0)
		return false;
	x0 *= c / g;
	y0 *= c / g;
	if (a < 0)   x0 *= -1;
	if (b < 0)   y0 *= -1;
	return true;
}

bool diofant_solve(ll a, ll b, ll c)
{
	ll x0, y0, g;
	
	if(!find_any_solution(a, b, c, x0, y0, g))
		return false;

	return -x0 * a <= y0 * b && ((-x0 * g) % b == 0 || (y0 * g) % a == 0 || (-x0 * g) / b != (y0 * g) / a);

}

bool solve(ll tw, ll th, ll w, ll h)
{
	if(w % tw == 0 && h % th == 0) return true;
	if(w % th == 0 && h % tw == 0) return true;
	if(w % tw == 0 && w % th == 0 && diofant_solve(tw, th, h)) return true;
	if(h % tw == 0 && h % th == 0 && diofant_solve(tw, th, w)) return true;
	return false;
}

int main()
{
	freopen("hotel.in", "r", stdin);
	//freopen("hotel.out", "w", stdout);
	ll a, b, c, d, test;
	cin >> test;
	assert(test > 0 && test <= 4000);
	while(test > 0)
	{
		cin >> a >> b >> c >> d;
		assert(a >= 1 && a <= 1000000000);
		assert(b >= 1 && b <= 1000000000);
		assert(c >= 1 && c <= 1000000000);
		assert(d >= 1 && d <= 1000000000);
		if(solve(a, b, c, d)) printf("YES");
		else printf("NO");
		printf("\n");

		test--;
	}
	return 0;
}