#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 */
typedef int /*<<< orphan*/ bit2;
typedef int /*<<< orphan*/ bit1;

/* Variables and functions */
scalar_t__ ArrayCmp(int *, int *);
scalar_t__ EOF;
int /*<<< orphan*/ LeftMove(int *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, int *, ...);
int main() {
  int m, n, i, j, times, flag;
  int bit1[16], bit2[16];
  while (scanf("%d", &times) != EOF) {
    for (i = 0; i < times; i++) {
      memset(bit1, 0, sizeof(bit1));
      memset(bit2, 0, sizeof(bit2));
      scanf("%d%d", &m, &n);
      j = 0;
      while (m > 0) {
        bit1[j] = m % 2;
        m /= 2;
        j++;
      }
      j = 0;
      while (n > 0) {
        bit2[j] = n % 2;
        n /= 2;
        j++;
      }
      j = 0;
      flag = 0;
      while (j < 20) {
        LeftMove(bit1);
        if (ArrayCmp(bit1, bit2)) {
          flag = 1;
          break;
        }
        j++;
      }
      if (flag)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe99(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    0x2e6d(%rip),%rcx
cmp    (%rcx),%rax
je     12e7 <main+0x197>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12e2 <main+0x192>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    0xe3f(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1210 <main+0xc0>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0x14(%rbp),%rax
mov    %edx,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d7 <main+0x87>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1253 <main+0x103>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0x14(%rbp),%rax
mov    %edx,-0xa0(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1217 <main+0xc7>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x14,-0x14(%rbp)
jge    12a8 <main+0x158>
lea    -0x60(%rbp),%rdi
call   1060 <LeftMove@plt>
lea    -0x60(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1030 <ArrayCmp@plt>
cmp    $0x0,%rax
je     129a <main+0x14a>
movl   $0x1,-0x1c(%rbp)
jmp    12a8 <main+0x158>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1261 <main+0x111>
cmpl   $0x0,-0x1c(%rbp)
je     12c3 <main+0x173>
lea    0xd4c(%rip),%rdi
call   1040 <printf@plt>
jmp    12cf <main+0x17f>
lea    0xd40(%rip),%rdi
call   1040 <printf@plt>
jmp    12d4 <main+0x184>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118b <main+0x3b>
jmp    1162 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xe9a(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x2e6d(%rip),%rcx
cmp    (%rcx),%rax
jne    1194 <main+0x44>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x50(%rsp),%rbx
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
jmp    11cf <main+0x7f>
nopw   0x0(%rax,%rax,1)
lea    0xe4b(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x2e1e(%rip),%rcx
cmp    (%rcx),%rax
je     1180 <main+0x30>
cmpl   $0x0,0x4(%rsp)
jle    11b0 <main+0x60>
xor    %ebp,%ebp
jmp    11f5 <main+0xa5>
nopw   0x0(%rax,%rax,1)
lea    0xe21(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jge    11b0 <main+0x60>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    0xde6(%rip),%rdi
mov    %r12,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1258 <main+0x108>
mov    %rbx,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%edx
mov    %eax,%esi
and    $0x1,%esi
mov    %esi,(%rcx)
shr    %eax
add    $0x4,%rcx
cmp    $0x1,%edx
ja     1240 <main+0xf0>
mov    %eax,0xc(%rsp)
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1288 <main+0x138>
mov    %r14,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edx
mov    %eax,%esi
and    $0x1,%esi
mov    %esi,(%rcx)
shr    %eax
add    $0x4,%rcx
cmp    $0x2,%edx
jae    1270 <main+0x120>
mov    %eax,0x8(%rsp)
mov    $0x14,%r15d
xchg   %ax,%ax
mov    %rbx,%rdi
call   1060 <LeftMove@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <ArrayCmp@plt>
test   %rax,%rax
jne    11e0 <main+0x90>
add    $0xffffffff,%r15d
jne    1290 <main+0x140>
lea    0xd4c(%rip),%rdi
jmp    11e7 <main+0x97>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%d%d\00"
@str = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [16 x i32]
%5 = alloca [16 x i32]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast [16 x i32]* %4 to i8*
%10 = bitcast [16 x i32]* %5 to i8*
%11 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %67, label %14
14: ; preds = %0
%15 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%16 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 0
br label %21
17: ; preds = %61, %21
%18 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %67, label %21
21: ; preds = %14, %17
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %17
24: ; preds = %21, %61
%25 = phi i32 [ %64, %61 ], [ 0, %21 ]
%26 = call i32 @memset(i32* %15, i32 0, i32 64)
%27 = call i32 @memset(i32* %16, i32 0, i32 64)
%28 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%29 = load i32, i32* %1
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %40
31: ; preds = %24, %31
%32 = phi i64 [ %37, %31 ], [ 0, %24 ]
%33 = phi i32 [ %36, %31 ], [ %29, %24 ]
%34 = and i32 %33, 1
%35 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 %32
store i32 %34, i32* %35
%36 = lshr i32 %33, 1
%37 = add nuw nsw i64 %32, 1
%38 = icmp ult i32 %33, 2
br i1 %38, label %39, label %31
39: ; preds = %31
store i32 %36, i32* %1
br label %40
40: ; preds = %39, %24
%41 = load i32, i32* %2
%42 = icmp sgt i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %44, %40
br label %56
44: ; preds = %45
store i32 %50, i32* %2
br label %43
45: ; preds = %40, %45
%46 = phi i64 [ %51, %45 ], [ 0, %40 ]
%47 = phi i32 [ %50, %45 ], [ %41, %40 ]
%48 = and i32 %47, 1
%49 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %46
store i32 %48, i32* %49
%50 = lshr i32 %47, 1
%51 = add nuw nsw i64 %46, 1
%52 = icmp ult i32 %47, 2
br i1 %52, label %44, label %45
53: ; preds = %56
%54 = add nuw nsw i32 %57, 1
%55 = icmp eq i32 %54, 20
br i1 %55, label %61, label %56
56: ; preds = %43, %53
%57 = phi i32 [ %54, %53 ], [ 0, %43 ]
%58 = call i32 @LeftMove(i32* %15)
%59 = call i64 @ArrayCmp(i32* %15, i32* %16)
%60 = icmp eq i64 %59, 0
br i1 %60, label %53, label %61
61: ; preds = %53, %56
%62 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %56 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %53 ]
%63 = call i32 @puts(i8* dereferenceable(1) %62)
%64 = add nuw nsw i32 %25, 1
%65 = load i32, i32* %3
%66 = icmp slt i32 %64, %65
br i1 %66, label %24, label %17
67: ; preds = %17, %0
ret i32 0
}