#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int solve(int &w)
{
int w1,w2,d1,d2;
bool b1 = true,b2 = true;
cin>>w1>>d1>>w2>>d2;
if(!w1) b1 = solve(w1);
if(!w2) b2 = solve(w2);
w = w1+w2;
return b1&&b2&&(w1*d1 == w2*d2);
}
int main()
{
int n,w;
cin>>n;
while(n--)
{
if(solve(w)) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
if(n) cout<<endl;
}
return 0;
}
/**
1
0 2 0 4
0 3 0 1
1 1 1 1
2 4 4 2
1 6 3 2
**/