#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
long long gcd(long long, long long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t;
  long long int xs, ys, xd, yd, gcd1, gcd2;
  scanf("%d", &t);
  while (t--) {
    scanf("%lld%lld%lld%lld", &xs, &ys, &xd, &yd);
    xd = xd < 0 ? -xd : xd;
    yd = yd < 0 ? -yd : yd;
    xs = xs < 0 ? -xs : xs;
    ys = ys < 0 ? -ys : ys;
    gcd1 = gcd(xs, ys);
    gcd2 = gcd(xd, yd);
    while (gcd1 > 0 && gcd1 < gcd2)
      gcd1 *= 2;
    if (gcd1 == gcd2)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     12bc <main+0x18c>
lea    0xe97(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
cmpq   $0x0,-0x20(%rbp)
jge    119d <main+0x6d>
xor    %eax,%eax
sub    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    11a5 <main+0x75>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    11c7 <main+0x97>
xor    %eax,%eax
sub    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    11cf <main+0x9f>
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    11f1 <main+0xc1>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    11f9 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    121b <main+0xeb>
xor    %eax,%eax
sub    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    1223 <main+0xf3>
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <gcd@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <gcd@plt>
mov    %rax,-0x38(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x30(%rbp)
mov    %al,-0x59(%rbp)
jle    126b <main+0x13b>
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
setl   %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    127b <main+0x14b>
jmp    128c <main+0x15c>
mov    -0x30(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    124d <main+0x11d>
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    12ab <main+0x17b>
lea    0xd73(%rip),%rdi
call   1030 <printf@plt>
jmp    12b7 <main+0x187>
lea    0xd67(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebb(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jae    1169 <main+0x39>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0x8(%rsp),%rbx
lea    0xe98(%rip),%r14
lea    0xe8e(%rip),%r15
jmp    11a6 <main+0x76>
nopl   0x0(%rax,%rax,1)
cmp    %rax,%rcx
mov    %r15,%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
subl   $0x1,0x4(%rsp)
jb     1158 <main+0x28>
lea    0xe56(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rax
mov    %rax,%rcx
neg    %rcx
cmovs  %rax,%rcx
mov    0x8(%rsp),%rax
mov    %rax,%rdx
neg    %rdx
cmovs  %rax,%rdx
mov    %rcx,0x10(%rsp)
mov    %rdx,0x8(%rsp)
mov    0x20(%rsp),%rax
mov    %rax,%rdi
neg    %rdi
cmovs  %rax,%rdi
mov    %rdi,0x20(%rsp)
mov    0x18(%rsp),%rax
mov    %rax,%rsi
neg    %rsi
cmovs  %rax,%rsi
mov    %rsi,0x18(%rsp)
call   1050 <gcd@plt>
mov    %rax,%rbp
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1050 <gcd@plt>
nopl   0x0(%rax)
mov    %rbp,%rcx
test   %rbp,%rbp
jle    1190 <main+0x60>
lea    (%rcx,%rcx,1),%rbp
cmp    %rax,%rcx
jl     1230 <main+0x100>
jmp    1190 <main+0x60>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [17 x i8] c"%lld%lld%lld%lld\00"
@.str.2 = [5 x i8] c"YES\0A\00"
@.str.3 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %78, %0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %79
14: ; preds = %10
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64* %3, i64* %4, i64* %5, i64* %6)
%16 = load i64, i64* %5
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i64, i64* %5
%20 = sub nsw i64 0, %19
br label %23
21: ; preds = %14
%22 = load i64, i64* %5
br label %23
23: ; preds = %21, %18
%24 = phi i64 [ %20, %18 ], [ %22, %21 ]
store i64 %24, i64* %5
%25 = load i64, i64* %6
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i64, i64* %6
%29 = sub nsw i64 0, %28
br label %32
30: ; preds = %23
%31 = load i64, i64* %6
br label %32
32: ; preds = %30, %27
%33 = phi i64 [ %29, %27 ], [ %31, %30 ]
store i64 %33, i64* %6
%34 = load i64, i64* %3
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i64, i64* %3
%38 = sub nsw i64 0, %37
br label %41
39: ; preds = %32
%40 = load i64, i64* %3
br label %41
41: ; preds = %39, %36
%42 = phi i64 [ %38, %36 ], [ %40, %39 ]
store i64 %42, i64* %3
%43 = load i64, i64* %4
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i64, i64* %4
%47 = sub nsw i64 0, %46
br label %50
48: ; preds = %41
%49 = load i64, i64* %4
br label %50
50: ; preds = %48, %45
%51 = phi i64 [ %47, %45 ], [ %49, %48 ]
store i64 %51, i64* %4
%52 = load i64, i64* %3
%53 = load i64, i64* %4
%54 = call i64 @gcd(i64 %52, i64 %53)
store i64 %54, i64* %7
%55 = load i64, i64* %5
%56 = load i64, i64* %6
%57 = call i64 @gcd(i64 %55, i64 %56)
store i64 %57, i64* %8
br label %58
58: ; preds = %67, %50
%59 = load i64, i64* %7
%60 = icmp sgt i64 %59, 0
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = load i64, i64* %7
%63 = load i64, i64* %8
%64 = icmp slt i64 %62, %63
br label %65
65: ; preds = %61, %58
%66 = phi i1 [ false, %58 ], [ %64, %61 ]
br i1 %66, label %67, label %70
67: ; preds = %65
%68 = load i64, i64* %7
%69 = mul nsw i64 %68, 2
store i64 %69, i64* %7
br label %58
70: ; preds = %65
%71 = load i64, i64* %7
%72 = load i64, i64* %8
%73 = icmp eq i64 %71, %72
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %78
76: ; preds = %70
%77 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %78
78: ; preds = %76, %74
br label %10
79: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [17 x i8] c"%lld%lld%lld%lld\00"
@str = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i32* %1 to i8*
%7 = bitcast i64* %2 to i8*
%8 = bitcast i64* %3 to i8*
%9 = bitcast i64* %4 to i8*
%10 = bitcast i64* %5 to i8*
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = add nsw i32 %12, -1
store i32 %13, i32* %1
%14 = icmp eq i32 %12, 0
br i1 %14, label %42, label %15
15: ; preds = %0, %35
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64* %2, i64* %3, i64* %4, i64* %5)
%17 = load i64, i64* %4
%18 = call i64 @llvm.abs.i64(i64 %17, i1 true)
store i64 %18, i64* %4
%19 = load i64, i64* %5
%20 = call i64 @llvm.abs.i64(i64 %19, i1 true)
store i64 %20, i64* %5
%21 = load i64, i64* %2
%22 = call i64 @llvm.abs.i64(i64 %21, i1 true)
store i64 %22, i64* %2
%23 = load i64, i64* %3
%24 = call i64 @llvm.abs.i64(i64 %23, i1 true)
store i64 %24, i64* %3
%25 = call i64 @gcd(i64 %22, i64 %24)
%26 = load i64, i64* %4
%27 = load i64, i64* %5
%28 = call i64 @gcd(i64 %26, i64 %27)
br label %29
29: ; preds = %29, %15
%30 = phi i64 [ %25, %15 ], [ %34, %29 ]
%31 = icmp sgt i64 %30, 0
%32 = icmp slt i64 %30, %28
%33 = select i1 %31, i1 %32, i1 false
%34 = shl nuw nsw i64 %30, 1
br i1 %33, label %29, label %35
35: ; preds = %29
%36 = icmp eq i64 %30, %28
%37 = select i1 %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%38 = call i32 @puts(i8* dereferenceable(1) %37)
%39 = load i32, i32* %1
%40 = add nsw i32 %39, -1
store i32 %40, i32* %1
%41 = icmp eq i32 %39, 0
br i1 %41, label %42, label %15
42: ; preds = %35, %0
ret i32 0
}