// #牛客春招刷题训练营# https://www.nowcoder.com/discuss/726480854079250432
#include <algorithm>
#include <iostream>
using namespace std;
int gcd(int x, int y){//---------gcd(x,y)是xy能通过加减组合出的最小的数;
while(y){
int temp = x % y;
x = y;
y = temp;
}
return x;
}
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int T;
cin >> T;
while(T--)
{
int x, y, a, b, c, d;
cin >> x >> y >> a >> b >> c >> d;
if (x % (gcd(max(c, d), min(c, d))) == 0 && y % (gcd(max(a, b), min(a, b))) == 0) cout << "YES\n";//--------如果x是gcd(c,d)的整数倍表示可以通过组合c,d取得x
else cout << "NO\n";
}
}
// 64 位输出请用 printf("%lld")