from math import gcd while True: try: T = int(input()) for _ in range(T): x, y, a, b, c, d = map(int, input().split()) if x % gcd(c, d) == 0 and y % gcd(a, b) == 0: print('YES') else: print('NO') except: break
from math import gcd while True: try: T = int(input()) for _ in range(T): x, y, a, b, c, d = map(int, input().split()) if x % gcd(c, d) == 0 and y % gcd(a, b) == 0: print('YES') else: print('NO') except: break