#include<iostream>
using namespace std;
int solve(int &W) /*这里一定要用引用,为了赋给它值*/
{
int wl, dl, wr, dr;
cin >> wl >> dl >> wr >> dr;
bool f1 = true, f2 = true;
if(!wl) f1 = solve(wl); /*沿着这个子天平找下去*/
if(!wr) f2 = solve(wr);
W = wl + wr; /*将它的重 加起来*/
return ( f1 && f2 && (wl*dl == wr*dr));
}
int main()
{
int T, W;
cin >> T;
while(T--)
{
if(solve(W))
cout << "YES" << endl;
else
cout << "NO" << endl;
if(T)
cout << endl;
}
return 0;
}