There is a new attraction in Singapore Zoo: The Infinite Zoo.

The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other edges in the graph.

Zookeeper has $q$ queries. In the $i$-th query she will ask you if she can travel from vertex $u_i$ to vertex $v_i$ by going through directed edges.


-----Input-----

The first line contains an integer $q$ ($1 \leq q \leq 10^5$) — the number of queries.

The $i$-th of the next $q$ lines will contain two integers $u_i$, $v_i$ ($1 \leq u_i, v_i < 2^{30}$) — a query made by Zookeeper.


-----Output-----

For the $i$-th of the $q$ queries, output "YES" in a single line if Zookeeper can travel from vertex $u_i$ to vertex $v_i$. Otherwise, output "NO".

You can print your answer in any case. For example, if the answer is "YES", then the output "Yes" or "yeS" will also be considered as correct answer.


-----Examples-----

Input
5
1 4
3 6
1 6
6 2
5 5
Output
YES
YES
NO
NO
YES


-----Note-----

The subgraph on vertices $1,2,3,4,5,6$ is shown below.

Difficulty: MEDIUM_HARD
Tags: Bit manipulation

Constructive algorithms

Greedy algorithms

Dynamic programming

Mathematics
Skill types: Dynamic programming

Bit manipulation

Greedy algorithms

Starter code:

Solutions:
import os
import sys
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def main():
	n = int(input())
	for i in range(n):
		(l, r) = map(int, input().split())
		if l > r:
			print('NO')
			continue
		u = bin(l).replace('0b', '')
		v = bin(r).replace('0b', '')
		f = []
		s = []
		for i in u:
			f.append(int(i))
		for i in v:
			s.append(int(i))
		f.reverse()
		s.reverse()
		if len(s) < len(f):
			for i in range(len(f) - len(s)):
				s.append(0)
		else:
			for i in range(len(s) - len(f)):
				f.append(0)
		f.append(0)
		ones = 0
		for i in range(len(s)):
			ones += f[i] == 1
			ones -= s[i] == 1
			if ones < 0:
				f[-1] = 1
		if f[-1]:
			print('NO')
		else:
			print('YES')
	return
main()


for ct in range(int(input())):
	(u, v) = map(int, input().split())
	if u > v:
		print('NO')
	else:
		total = 0
		for i in range(30):
			if 1 << i & u:
				total += 1
			if 1 << i & v:
				total -= 1
			if total < 0:
				break
		print('YES') if total >= 0 else print('NO')


t = int(input())

def lsb(a):
	return a & -a

def solve():
	(a, b) = map(int, input().split())
	if a > b:
		return 'NO'
	else:
		ispossible = True
		while b != 0:
			if lsb(a) > lsb(b) or a == 0:
				return 'NO'
			else:
				a -= lsb(a)
				b -= lsb(b)
	return 'YES'
for qwerty in range(t):
	print(solve())


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil, log, inf, gcd, floor
from itertools import permutations
from copy import deepcopy
from heapq import *

def lcm(a, b):
	return a * b // gcd(a, b)

def fact(n, mo):
	f = [1]
	for i in range(1, n + 1):
		f.append(f[-1] * i % mo)
	invf = [0] * (n + 1)
	invf = pow(f[-1], mo - 2, mo)
	for i in range(n - 1, -1, -1):
		invf[i] = (i + 1) * invf[i + 1] % mo
	return (f, invf)

def mod(a, m):
	if a > m:
		return a % m
	return a

def solve(x, y):
	y = bin(y)[2:][::-1]
	x = bin(x)[2:][::-1]
	(d, ans, lby, lbx) = (0, 1, len(y), len(x))
	for j in range(lby):
		if j < lbx:
			if x[j] == '1':
				d += 1
			if y[j] == '1':
				d -= 1
		elif y[j] == '1':
			d -= 1
		if d < 0:
			return 'NO'
	return 'YES'

def main():
	for _ in range(int(input())):
		(x, y) = map(int, input().split())
		if x > y:
			print('NO')
		elif x == y:
			print('YES')
		else:
			z = 1 << x.bit_length()
			if z // 2 == x:
				zz = 1 << y.bit_length()
				if zz // 2 == y:
					print('YES')
				else:
					print('NO')
			else:
				print(solve(x, y))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def next(x):
	get_bin = lambda x: format(x, 'b')
	b = get_bin(x)
	mult = 1
	l = set({0})
	newlist = set()
	i = len(b) - 1
	while i >= 0:
		if b[i] == '1':
			for j in l:
				newlist.add(j + mult)
			l = l.union(newlist)
		mult *= 2
		i -= 1
	return l
for q in range(int(input())):
	(u, v) = list(map(int, input().split()))
	if u > v:
		print('NO')
	else:
		possible = True
		bu = format(u, 'b')
		bv = format(v, 'b')
		ones = 0
		i = -1
		while i >= -len(bu):
			if bu[i] == '0':
				if bv[i] == '1':
					ones -= 1
					if ones < 0:
						print('NO')
						possible = False
						break
			elif bv[i] == '0':
				ones += 1
			i -= 1
		if possible:
			for i in range(len(bv) - len(bu)):
				if bv[i] == '1':
					ones -= 1
			if ones >= 0:
				print('YES')
			else:
				print('NO')


import logging
import sys
from inspect import currentframe
input = sys.stdin.readline
logging.basicConfig(level=logging.DEBUG)

def dbg(*args):
	id2names = {id(v): k for (k, v) in currentframe().f_back.f_locals.items()}
	logging.debug(', '.join((id2names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args)))

def f(num):
	res = []
	cnt = 0
	while num > 0:
		if num % 2 == 1:
			res.append(cnt)
		cnt += 1
		num //= 2
	return res

def solve():
	(u, v) = map(int, input().split())
	ubit = f(u)
	vbit = f(v)
	if u > v:
		return False
	if max(ubit) > max(vbit):
		return False
	if min(ubit) > min(vbit):
		return False
	if len(ubit) < len(vbit):
		return False
	max_cnt = len(vbit)
	cnt = 0
	u_idx = 0
	for vb in vbit:
		if vb < ubit[u_idx]:
			return False
		else:
			cnt += 1
			u_idx += 1
	if cnt == max_cnt:
		return True
	else:
		return False

def main():
	t = int(input())
	for _ in range(t):
		print('YES' if solve() else 'NO')
main()


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
import math

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
no = 'NO'
yes = 'YES'

def solve(_):
	(u, v) = li()
	if u > v:
		print(no)
		return
	u = list(bin(u)[2:][::-1])
	v = list(bin(v)[2:][::-1])
	if len(u) > len(v):
		print(no)
		return
	cntu = 0
	cntv = 0
	for i in range(len(u)):
		if u[i] == '1':
			cntu += 1
		if v[i] == '1':
			cntv += 1
		if cntu < cntv:
			print(no)
			return
	if u.count('1') < v.count('1'):
		print(no)
		return
	print(yes)
t = 1
t = int(input())
for _ in range(t):
	solve(_)


import sys

def isT(u1, u2):
	if u1 > u2:
		return False
	else:
		while u2 > 1:
			if u2 & -u2 < u1 & -u1 or u1 == 0:
				return False
			u1 -= u1 & -u1
			u2 -= u2 & -u2
		return True
q = int(sys.stdin.readline())
for i in range(q):
	(u1, u2) = list(map(int, sys.stdin.readline().split()))
	if isT(u1, u2):
		print('YES')
	else:
		print('NO')


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = ['NO'] * T
limit = 33
for qu in range(T):
	(u, v) = map(int, readline().split())
	if u <= v:
		p = 0
		for k in range(limit):
			if 1 << k & u == 1 << k & v:
				continue
			if 1 << k & u == 0:
				p -= 1
				if p < 0:
					break
			else:
				p += 1
		else:
			Ans[qu] = 'YES'
print('\n'.join(Ans))


import os
import sys
from bisect import bisect_right
from collections import Counter
from io import BytesIO, IOBase
from math import gcd, inf, sqrt

def lcm(a, b):
	return a * b // gcd(a, b)

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def printDivisors(n):
	i = 2
	z = [1, n]
	while i <= sqrt(n):
		if n % i == 0:
			if n / i == i:
				z.append(i)
			else:
				z.append(i)
				z.append(n // i)
		i = i + 1
	return z

def cheaker(a):
	j = 1
	p = False
	for i in a:
		if i != j:
			break
		j += 1
	q = len(a)
	for i in a[::-1]:
		if i != q:
			break
		q -= 1
	for i in range(j - 1, q):
		if a[i] == i + 1:
			return False
	return True

def create(n, x, f):
	pq = len(bin(n)[2:])
	if f == 0:
		tt = min
	else:
		tt = max
	dp = [[inf] * n for _ in range(pq)]
	dp[0] = x
	for i in range(1, pq):
		for j in range(n - (1 << i) + 1):
			dp[i][j] = tt(dp[i - 1][j], dp[i - 1][j + (1 << i - 1)])
	return dp

def enquiry(l, r, dp, f):
	if l > r:
		return inf if not f else -inf
	if f == 1:
		tt = max
	else:
		tt = min
	pq1 = len(bin(r - l + 1)[2:]) - 1
	return tt(dp[pq1][l], dp[pq1][r - (1 << pq1) + 1])

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	x = []
	for i in range(2, n + 1):
		if prime[i]:
			x.append(i)
	return x

def main():
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		if a == b:
			print('YES')
		elif a > b:
			print('NO')
		else:
			y = list(bin(b)[2:][::-1])
			x = list(bin(a)[2:][::-1])
			c = 0
			an = 1
			for j in range(len(y)):
				if j >= len(x):
					if y[j] == '1':
						c -= 1
				else:
					if x[j] == '1':
						c += 1
					if y[j] == '1':
						c -= 1
				if c < 0:
					an = -1
					break
			if an == -1:
				print('NO')
			else:
				print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math
input = sys.stdin.readline
t = int(input())
for test in range(t):
	[u, v] = list(map(int, input().split(' ')))
	s = [0 for i in range(31)]
	r = [0 for i in range(31)]
	p = 0
	pp = 0
	for i in range(31):
		s[i] = u % 2
		u = u // 2
	for i in range(31):
		r[i] = v % 2
		v = v // 2
	res = True
	for i in range(31):
		if s[i] == 0 and r[i] == 0 and (pp == 0):
			continue
		elif s[i] == 1 and r[i] == 1 and (pp == 0):
			continue
		elif s[i] == 0 and r[i] == 0 and (pp >= 1):
			continue
		elif s[i] == 1 and r[i] == 1 and (pp >= 1):
			continue
		elif s[i] == 0 and r[i] == 1 and (pp == 0):
			res = False
			break
		elif s[i] == 0 and r[i] == 1 and (p == 0) and (pp > 0):
			pp -= 1
		elif s[i] == 0 and r[i] == 1 and (p == 1):
			p = 0
			pp -= 1
		elif s[i] == 1 and r[i] == 0 and (pp >= 1):
			pp += 1
			p = 1
		elif s[i] == 1 and r[i] == 0 and (pp == 0):
			p = 1
			pp = 1
	if p == 1:
		res = False
	if res:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	for j in range(int(input())):
		(u, v) = map(int, input().split())
		bitu = [int(k) for k in bin(u)[2:]]
		bitv = [int(k) for k in bin(v)[2:]]
		if sum(bitv) <= sum(bitu) and u <= v:
			broke = False
			c1 = 0
			c2 = 0
			for i in range(len(bitu)):
				if bitu[-1 - i] == 1:
					c1 += 1
				if bitv[-1 - i] == 1:
					c2 += 1
				if c2 <= c1:
					continue
				else:
					broke = True
					break
			if not broke:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
main()


from collections import deque
import copy
import sys
input = sys.stdin.readline

def solve(u, v):
	a = []
	b = []
	for bit in range(30):
		if u & 1 << bit:
			a.append(bit)
		if v & 1 << bit:
			b.append(bit)
	ans = True
	if len(a) < len(b):
		ans = False
	else:
		for i in range(len(b)):
			if a[i] > b[i]:
				ans = False
	ans &= u <= v
	if ans == True:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for _ in range(t):
	(u, v) = map(int, input().split())
	print(solve(u, v))


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
q = int(input())
for _ in range(q):
	(u, v) = list(map(int, input().split()))
	if u > v:
		print('NO')
	else:
		ans = True
		while v > 0:
			if v & -v < u & -u or u == 0:
				ans = False
			v -= v & -v
			u -= u & -u
		if ans:
			print('YES')
		else:
			print('NO')


def lsb(x):
	return x & -x
q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	if a > b:
		print('NO')
		continue
	flg = True
	while b > 0:
		if lsb(b) < lsb(a) or a == 0:
			flg = False
			break
		a -= lsb(a)
		b -= lsb(b)
	print('YES' if flg else 'NO')


from itertools import zip_longest
from sys import *
input = stdin.readline
for _ in range(int(input())):
	(u, v) = map(int, input().split())
	(bit_u, bit_v) = (bin(u)[2:][::-1], bin(v)[2:][::-1])
	(cnt_u, cnt_v) = (0, 0)
	ans = 0
	for (i, j) in zip_longest(bit_u, bit_v, fillvalue='0'):
		if i == '1':
			cnt_u += 1
		if j == '1':
			cnt_v += 1
		if cnt_v > cnt_u:
			break
	if cnt_v > cnt_u or v < u:
		print('No')
	else:
		print('Yes')


def main(u, v):
	if u > v:
		return False
	if u == v:
		return True
	if u & 1 == 0 and v & 1 == 1:
		return False
	if u & 1 == v & 1:
		return main(u >> 1, v >> 1)
	if u & 2 == 0:
		return main(u + 1, v)
	k = 1
	while k & u == k:
		k <<= 1
		k += 1
	k >>= 1
	if u + k >= v:
		return True
	return main(u + k, v)
res = []
for _ in range(int(input())):
	(u, v) = map(int, input().split())
	res.append('YES' if main(u, v) else 'NO')
print(*res, sep='\n')


def lsb(x):
	return x & -x
Q = int(input())
for q in range(Q):
	(a, b) = map(int, input().split(' '))
	if a > b:
		print('NO')
	else:
		can = True
		while b > 0:
			if lsb(a) > lsb(b) or a == 0:
				can = False
				break
			a -= lsb(a)
			b -= lsb(b)
		if can:
			print('YES')
		else:
			print('NO')


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
Q = int(input())
for _ in range(Q):
	(u, v) = map(int, input().split())
	if u > v:
		print('NO')
		continue
	cnt = 0
	while u or v:
		u0 = u & 1
		v0 = v & 1
		u >>= 1
		v >>= 1
		if u0:
			cnt += 1
		if v0:
			cnt -= 1
			if cnt < 0:
				print('NO')
				break
	else:
		print('YES')


for i in range(int(input())):
	(x, y) = map(int, input().split())
	k1 = k2 = 0
	flg = 0
	if x > y:
		print('NO')
	else:
		for j in range(2 ** 5):
			k1 += (x >> j) % 2
			k2 += (y >> j) % 2
			if k2 > k1:
				print('NO')
				flg = 1
				break
		if flg == 0:
			print('YES')


def toBinArr(n, size=None):
	if size is None:
		arr = []
		while n > 0:
			arr.append(n % 2)
			n //= 2
	else:
		arr = [0] * size
		i = 0
		while n > 0:
			arr[i] = n % 2
			n //= 2
			i += 1
	return arr

def solve(src, dst):
	if dst < src:
		return False
	dst = toBinArr(dst)
	src = toBinArr(src, len(dst) + 1)
	for i in range(len(dst)):
		if src[i] == dst[i]:
			continue
		elif dst[i] == 0:
			src[i] = 0
			src[i + 1] += 1
		elif dst[i] == 1:
			if src[i] == 0:
				return False
			elif src[i] == 2:
				src[i] = 1
				src[i + 1] += 1
			else:
				print('Fail')
	if src[-1] == 1:
		return False
	return True

def solve2(src, dst):
	if dst < src:
		return False
	dst = toBinArr(dst)
	src = toBinArr(src, len(dst))
	(accSrc, accDst) = (0, 0)
	for i in range(len(dst)):
		accSrc += src[i]
		accDst += dst[i]
		if accDst > accSrc:
			return False
	return True
numCases = int(input())
for i in range(1, numCases + 1):
	(src, dst) = [int(s) for s in input().split(' ')]
	ans = solve2(src, dst)
	if ans == True:
		print('YES')
	else:
		print('NO')


def f(x):
	a = []
	while x:
		a.append(x & 1)
		x //= 2
	return a + [0] * (30 - len(a))
for _ in range(int(input())):
	(u, v) = map(int, input().split())
	if u > v:
		print('NO')
		continue
	(a, b) = (f(u), f(v))
	if a.count(1) < b.count(1):
		print('NO')
		continue
	flag = 0
	ac = bc = 0
	for i in range(30):
		bc += b[i]
		ac += a[i]
		if b[i] == 1 and a[i] == 0:
			if bc > ac:
				print('NO')
				flag = 1
				break
	if flag == 0:
		print('YES')


from itertools import zip_longest
Q = int(input())
queries = [tuple(map(int, input().split())) for _ in range(Q)]

def popcnt(x):
	return bin(x).count('1')
for (u, v) in queries:
	if u > v:
		print('NO')
	elif u == v:
		print('YES')
	else:
		u = bin(u)[::-1]
		v = bin(v)[::-1]
		battle = 0
		for (x, y) in zip_longest(u, v[:-2]):
			battle += int(x == '1') - int(y == '1')
			if battle < 0:
				print('NO')
				break
		else:
			print('YES')


for rpt in range(int(input())):
	(u, v) = [int(x) for x in input().split()]
	binu = [int(x) for x in list('{0:0b}'.format(u))]
	binv = [int(x) for x in list('{0:0b}'.format(v))]
	if u > v or len(binu) > len(binv):
		print('NO')
	else:
		binu = [0 for x in range(len(binv) - len(binu))] + binu
		ones_availible = 0
		for i in range(len(binv) - 1, -1, -1):
			if binu[i] == 1:
				ones_availible += 1
			if binv[i] == 1:
				ones_availible -= 1
				if ones_availible < 0:
					break
		if ones_availible < 0:
			print('NO')
		else:
			print('YES')


for w in range(int(input())):
	(a, b) = tuple(map(int, input().split()))
	if b < a:
		print('NO')
	elif b == a or b == 2 * a:
		print('YES')
	else:
		u = a
		v = b
		u_binary = bin(u).replace('0b', '')[::-1]
		v_binary = bin(v).replace('0b', '')[::-1]
		x = 0
		y = 0
		ans = 1
		i = 0
		while i < max(len(u_binary), len(v_binary)):
			if i < len(u_binary):
				if u_binary[i] == '1':
					x += 1
			if i < len(v_binary):
				if v_binary[i] == '1':
					y += 1
			if y > x:
				ans = 0
				break
			i += 1
		if ans == 0:
			print('NO')
		else:
			print('YES')


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(x, y) = R()
	(a, b) = (x, y)
	p = []
	q = []
	while a:
		p += (a % 2,)
		a >>= 1
	while b:
		q += (b % 2,)
		b >>= 1
	if x > y or sum(q) > sum(p):
		print('NO')
	else:
		flg = True
		x = 0
		y = 0
		for i in range(len(p)):
			x += p[i]
			y += q[i]
			if y > x:
				flg = False
				break
		print('YES' if flg else 'NO')


import sys
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def dadd(d, p, val):
	if p in d:
		d[p].append(val)
	else:
		d[p] = [val]

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def prec(a, pre):
	for i in a:
		pre.append(pre[-1] + i)
	pre.pop(0)

def YN(flag):
	print('YES' if flag else 'NO')

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
INF = 10 ** 18
uu = t

def dfs(i):
	vis[i] = 1
	if i > n:
		return
	for j in a[i]:
		if j not in vis:
			dfs(j)
while t > 0:
	t -= 1
	(u, v) = mi()
	if u > v:
		print('NO')
	else:
		flag = 0
		p = bin(u)[2:]
		q = bin(v)[2:]
		p = (len(q) - len(p)) * '0' + p
		c = d = 0
		for i in range(len(p) - 1, -1, -1):
			c += int(p[i])
			d += int(q[i])
			if d > c:
				flag = 1
				break
		YN(flag ^ 1)


import sys
input = iter(sys.stdin.read().splitlines()).__next__
q = int(input())
output = []
for _ in range(q):
	(u, v) = map(int, input().split())
	if u > v:
		output.append('NO')
		continue
	count_u = 0
	count_v = 0
	while v > 0:
		count_u += u & 1
		count_v += v & 1
		if count_v > count_u:
			output.append('NO')
			break
		u >>= 1
		v >>= 1
	else:
		output.append('YES')
print(*output, sep='\n')


import sys

def read_ints():
	return [int(i) for i in sys.stdin.readline().strip().split()]

def read_int():
	return int(sys.stdin.readline().strip())

def path(u, v):
	if u > v:
		return False
	ub = '{0:b}'.format(u).zfill(32)[::-1]
	vb = '{0:b}'.format(v).zfill(32)[::-1]
	u_ones = 0
	v_ones = 0
	for (uc, vc) in zip(ub, vb):
		if uc == '1':
			u_ones += 1
		if vc == '1':
			v_ones += 1
		if v_ones > u_ones:
			return False
	return True
q = read_int()
for i in range(q):
	(u, v) = read_ints()
	if path(u, v):
		print('YES')
	else:
		print('NO')


q = int(input())
for _ in range(q):
	(u, v) = map(int, input().split())
	bu = bin(u)[2:][::-1]
	bv = bin(v)[2:][::-1]
	if u > v or bu.count('1') < bv.count('1'):
		print('NO')
		continue
	uCounts = [i for (i, c) in enumerate(bu) if c == '1']
	vCounts = [i for (i, c) in enumerate(bv) if c == '1']
	for j in range(len(vCounts)):
		if vCounts[j] < uCounts[j]:
			print('NO')
			break
	else:
		print('YES')


T = int(input())
for _ in range(T):
	(U, V) = map(int, input().split())
	if U == V:
		print('YES')
	elif U > V:
		print('NO')
	else:
		uc = bin(U).count('1')
		vc = bin(V).count('1')
		if uc < vc:
			print('NO')
		else:
			(u, v) = (0, 0)
			for i in range(32):
				if U >> i & 1:
					u += 1
				if V >> i & 1:
					v += 1
				if u < v:
					print('NO')
					break
			else:
				print('YES')


q = int(input())
for _ in range(q):
	(u, v) = [int(x) for x in input().split()]
	if u > v:
		print('NO')
		continue
	if u == v:
		print('YES')
		continue
	count_u = 0
	count_v = 0
	fine = True
	for i in range(30):
		if u & 2 ** i:
			count_u += 1
		if v & 2 ** i:
			count_v += 1
		if count_v > count_u:
			fine = False
			print('NO')
			break
	if fine:
		print('YES')


def f(n):
	for i in range(1, n):
		if i & n - i == n - i:
			print(i, n)
for tc in range(int(input())):
	(u, v) = map(int, input().split())
	if u > v:
		print('NO')
		continue
	elif u == v:
		print('YES')
		continue
	binu = bin(u)[2:]
	binv = bin(v)[2:]
	binu = '0' * (len(binv) - len(binu)) + binu
	binu = binu[::-1]
	binv = binv[::-1]
	(cntu, cntv) = (0, 0)
	for i in range(len(binu)):
		cntv += binv[i] == '1'
		cntu += binu[i] == '1'
		if cntv > cntu:
			print('NO')
			break
	else:
		print('YES')


q = int(input())
queries = [tuple(map(int, input().split())) for _ in range(q)]
for (u, v) in queries:
	if u > v:
		print('No')
		continue
	u = [int(c) for c in bin(u)[:1:-1]]
	v = [int(c) for c in bin(v)[:1:-1]]
	ui = [i for (i, x) in enumerate(u) if x == 1]
	vi = [i for (i, x) in enumerate(v) if x == 1]
	if len(vi) > len(ui):
		print('No')
		continue
	ui = ui[:len(vi)]
	print('Yes' if all((x <= y for (x, y) in zip(ui, vi))) else 'No')


import sys
input = sys.stdin.readline

def main():
	Q = int(input())
	UV = [[int(x) for x in input().split()] for _ in range(Q)]
	for (u, v) in UV:
		if u == v:
			print('YES')
		elif u > v:
			print('NO')
		else:
			u_one = bin(u).count('1')
			u_i = []
			v_i = []
			for i in range(32):
				if u >> i & 1:
					u_i.append(i)
				if v >> i & 1:
					v_i.append(i)
			v_one = bin(v).count('1')
			if u_one == v_one:
				f = True
				for (a, b) in zip(u_i, v_i):
					if a > b:
						f = False
						break
				if f:
					print('YES')
				else:
					print('NO')
			elif u_one > v_one:
				f = True
				for (a, b) in zip(u_i, v_i):
					if a > b:
						f = False
						break
				if f:
					print('YES')
				else:
					print('NO')
			else:
				print('NO')
main()


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import heapify, heappop, heappush
from statistics import median, mean
from math import gcd, sqrt, floor, factorial, ceil, log2, log10, log
import fractions
import copy
from copy import deepcopy
import sys
import io
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import random, randint, randrange
from time import time

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def get_list():
	return list(map(int, input().split()))

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

def get_map():
	return map(int, input().split())

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'
t = int(input())
dict = defaultdict(int)
for i in range(t):
	(a, b) = get_map()
	if a == b:
		print(yc)
		continue
	if a > b:
		print(nc)
		continue
	if (a, b) in dict:
		print(dict[a, b])
		continue
	bina = bin(a)[2:]
	binb = bin(b)[2:]
	if bina.count('1') < binb.count('1'):
		print(nc)
		continue
	arraya = [0]
	arrayb = [0]
	for i in range(len(bina) - 1, -1, -1):
		if bina[i] == '1':
			arraya.append(arraya[-1] + 1)
		else:
			arraya.append(arraya[-1])
	for i in range(len(binb) - 1, -1, -1):
		if binb[i] == '1':
			arrayb.append(arrayb[-1] + 1)
		else:
			arrayb.append(arrayb[-1])
	flag = 1
	for i in range(len(arraya)):
		if arraya[i] >= arrayb[i]:
			continue
		else:
			flag = 0
			break
	if flag:
		dict[a, b] = yc
		print(yc)
	else:
		print(nc)
		dict[a, b] = nc


for _ in range(int(input())):
	(u, v) = map(int, input().split())

	def zeroes(x):
		c = 0
		while x & 1 == 0:
			x //= 2
			c += 1
		return c

	def bits(x):
		c = 1
		ret = []
		while c <= x:
			if c & x:
				ret.append(c)
			c *= 2
		return ret
	bu = bits(u)
	bv = bits(v)
	if u <= v and len(bu) >= len(bv) and (zeroes(u) <= zeroes(v)):
		bu = bu[0:len(bv)]
		possible = True
		for (ui, vi) in zip(bu, bv):
			if ui > vi:
				possible = False
				break
		print('yEs' if possible else 'nO')
	else:
		print('No')


q = int(input())
while q:
	q -= 1
	(x, y) = map(int, input().split())
	(binx, biny) = (list(map(int, list(bin(x)[:1:-1]))), list(map(int, list(bin(y)[:1:-1]))))
	(cntx, cnty) = (0, 0)
	tag = True
	if x > y:
		print('NO')
		continue
	for i in range(len(binx)):
		if binx[i] == 1:
			cntx += 1
		if biny[i] == 1:
			cnty += 1
		if cntx < cnty:
			tag = False
	if sum(binx) >= sum(biny) and tag and (x <= y):
		print('YES')
	else:
		print('NO')


def main():
	import sys
	input = sys.stdin.buffer.readline
	q = int(input())
	Q = [tuple(map(int, input().split())) for i in range(q)]
	ans = []
	for (u, v) in Q:
		if v < u:
			ans.append('NO')
			continue
		u = bin(u)[2:]
		v = bin(v)[2:]
		x = u.count('1')
		y = u.count('1')
		if x < y:
			ans.append('NO')
		else:
			U = []
			V = []
			for z in v:
				V.append(int(z))
			if len(v) > len(u):
				d = len(v) - len(u)
				for i in range(d):
					U.append(0)
			for z in u:
				U.append(int(z))
			n = len(V)
			pu = 0
			flag = 1
			for i in range(n):
				if V[i]:
					if pu < i:
						pu = i
					flag2 = 1
					for j in range(pu, n):
						if U[j]:
							flag2 = 0
							pu = j + 1
							break
					if flag2:
						flag = 0
						break
			if flag:
				ans.append('YES')
			else:
				ans.append('NO')
	print('\n'.join(ans))
main()


n = int(input())
for j in range(n):
	(p, q) = map(int, input().split())
	if p > q:
		print('NO')
	elif p == q:
		print('YES')
	else:
		poss = 1
		while q > 0:
			if p == 0 or q & -q < p & -p:
				poss = 0
				break
			else:
				p -= p & -p
				q -= q & -q
		if poss:
			print('YES')
		else:
			print('NO')


Q = int(input())
ans = ['YES'] * Q
for t in range(Q):
	(u, v) = map(int, input().split())
	if u > v:
		ans[t] = 'NO'
		continue
	cum1 = cum2 = 0
	for i in range(32):
		if (u >> i) % 2:
			cum1 += 1
		if (v >> i) % 2:
			cum2 += 1
		if cum1 < cum2:
			ans[t] = 'NO'
			break
print(*ans, sep='\n')


queries = int(input())
for _ in range(queries):
	(u, v) = map(int, input().split(' '))
	if u > v:
		print('NO')
		continue
	elif u == v:
		print('YES')
		continue
	u_bin = bin(u).replace('0b', '')
	v_bin = bin(v).replace('0b', '')
	if len(u_bin) < len(v_bin):
		u_bin = '0' * (len(v_bin) - len(u_bin)) + u_bin
	u_bin = u_bin[::-1]
	v_bin = v_bin[::-1]
	(count_u, count_v) = (0, 0)
	stop = False
	for i in range(len(u_bin)):
		if u_bin[i] == '1':
			count_u += 1
		if v_bin[i] == '1':
			count_v += 1
		if count_v > count_u:
			print('NO')
			stop = True
			break
	if not stop:
		print('YES')


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
for _ in range(inp()):
	(a, b) = inpl()
	res = False
	if a > b:
		pass
	else:
		A = list(bin(a))
		A = A[2:]
		B = list(bin(b))
		B = B[2:]
		if A.count('1') >= B.count('1'):
			rem = 0
			for i in range(30):
				aa = (a >> i) % 2
				bb = (b >> i) % 2
				rem += aa - bb
				if rem < 0:
					break
			else:
				res = True
	print('YES' if res else 'NO')


from math import *
mod = 10 ** 9 + 7

def numBits(n):
	ans = 0
	while n:
		ans = ans + 1
		n = n & n - 1
	return ans

def main():
	(x, y) = [int(x) for x in input().split(' ')]
	if x > y:
		print('NO')
	elif x == y:
		print('YES')
	else:
		prev = 0
		while y:
			prev = prev + 1
			lb = y & -y
			mask = 2 * lb - 1
			cnt = numBits(x & mask)
			if cnt < prev:
				print('NO')
				return
			y = y & y - 1
		print('YES')
tt = int(input())
for _ in range(tt):
	main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	(u, v) = map(int, input().split())
	x = bin(u).lstrip('0b')
	y = bin(v).lstrip('0b')
	a = x.count('1')
	b = y.count('1')
	if v >= u and b <= a:
		ans = 'YES'
		c = 0
		d = 0
		for i in range(-1, -min(len(x), len(y)) - 1, -1):
			if x[i] == '1':
				c += 1
			if y[i] == '1':
				d += 1
			if d > c:
				ans = 'NO'
				break
		print(ans)
	else:
		print('NO')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt, log2
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	(x, y) = sep()
	if x > y:
		print('NO')
		return
	xbin = list(bin(x)[2:])
	ybin = list(bin(y)[2:])
	f = xbin.count('1')
	s = ybin.count('1')
	find = [0] * (len(xbin) + 1)
	sind = [0] * (len(ybin) + 1)
	for i in range(len(xbin) - 1, -1, -1):
		if xbin[i] == '1':
			find[i] = find[i + 1] + 1
		else:
			find[i] = find[i + 1]
	for i in range(len(ybin) - 1, -1, -1):
		if ybin[i] == '1':
			sind[i] = sind[i + 1] + 1
		else:
			sind[i] = sind[i + 1]
	i = len(xbin) - 1
	j = len(ybin) - 1
	while i >= 0 or j >= 0:
		if sind[max(j, 0)] > find[max(i, 0)]:
			print('NO')
			return
		i -= 1
		j -= 1
	print('YES')
testcase(int(inp()))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=-10 ** 6, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(200001)]
pp = [0] * 200001

def SieveOfEratosthenes(n=200000):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if b < a:
		print('NO')
		continue
	if b == a:
		print('YES')
		continue
	(c1, c2) = (0, 0)
	ch = 1
	while a > 0 or b > 0:
		c1 += a % 2
		c2 += b % 2
		a //= 2
		b //= 2
		if c2 > c1:
			ch = 0
	if ch:
		print('YES')
	else:
		print('NO')


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	(u, v) = [int(i) for i in input().split()]
	if u > v:
		print('NO')
		continue
	bu = bin(u)[2:][::-1]
	bv = bin(v)[2:][::-1]
	cu = 0
	cv = 0
	flag = 0
	for i in range(len(bu)):
		if bu[i] == '1':
			cu += 1
		if bv[i] == '1':
			cv += 1
		if cu < cv:
			flag = 1
			break
	if bu.count('1') < bv.count('1'):
		flag = 1
	if flag:
		print('NO')
	else:
		print('YES')


test = int(input())
for t in range(test):
	(u, v) = map(int, input().split())
	if u > v:
		print('NO')
		continue
	k = 0
	l = 0
	while v > 0:
		k += u % 2
		l += v % 2
		if l > k:
			break
		u //= 2
		v //= 2
	if v > 0:
		print('NO')
	else:
		print('YES')


def main():
	q = int(input())
	allans = []
	for _ in range(q):
		(u, z) = readIntArr()
		u2 = bin(u)[2:][::-1]
		z2 = bin(z)[2:][::-1]
		if z < u:
			ans = 'No'
		else:
			n = len(z2)
			cumuU = 0
			cumuZ = 0
			ok = True
			for i in range(n):
				if i < len(u2) and u2[i] == '1':
					cumuU += 1
				if z2[i] == '1':
					cumuZ += 1
				if cumuU < cumuZ:
					ok = False
			if ok:
				ans = 'Yes'
			else:
				ans = 'No'
		allans.append(ans)
	multiLineArrayPrint(allans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
for _ in range(1):
	main()


for s in [*open(0)][1:]:
	(u, v) = map(int, s.split())
	n = 0
	while u < v and n >= 0:
		n += u % 2 - v % 2
		v >>= 1
		u >>= 1
	print('YNEOS'[u != v or n < 0::2])


from sys import stdin, stdout
input = stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if b < a:
		print('no')
		continue
	ans = 'yes'
	x = 0
	y = 0
	for i in range(32):
		if a & 1 << i:
			x += 1
		if b & 1 << i:
			y += 1
		if y > x:
			ans = 'no'
			break
	print(ans)


def lsb(x):
	return x & -x

def solve(x, y):
	if x == y:
		return True
	if x > y:
		return False
	while y:
		if x == 0 or lsb(x) > lsb(y):
			return False
		x -= lsb(x)
		y -= lsb(y)
	return True
q = int(input())
for i in range(q):
	(x, y) = map(int, input().split())
	if solve(x, y):
		print('YES')
	else:
		print('NO')


import gc
import heapq
import itertools
import math
from collections import Counter, deque, defaultdict
from sys import stdout
import time
from math import factorial, log, gcd
import sys
from decimal import Decimal
import threading
from heapq import *
from fractions import Fraction
import bisect

def S():
	return sys.stdin.readline().split()

def I():
	return [int(i) for i in sys.stdin.readline().split()]

def II():
	return int(sys.stdin.readline())

def IS():
	return sys.stdin.readline().replace('\n', '')

def main():
	(u, v) = I()
	if u > v:
		print('NO')
		return
	(u, v) = map(lambda x: bin(x)[2:][::-1], [u, v])
	idx_u = []
	for i in range(len(u)):
		if u[i] == '1':
			idx_u.append(i)
	c = v.count('1')
	if c > len(idx_u):
		print('NO')
		return
	idx = 0
	for i in range(len(v)):
		if v[i] == '1':
			if i < idx_u[idx]:
				print('NO')
				return
			idx += 1
			if idx == c:
				break
	print('YES')
for _ in range(II()):
	main()


import os
from io import BytesIO, IOBase
import sys

def main():
	for i in range(int(input())):
		(u, v) = map(int, input().split())
		gu = []
		gv = []
		c = 0
		k = 0
		while u > 0 or v > 0:
			gu.append(u % 2)
			gv.append(v % 2)
			u = u // 2
			v = v // 2
			c = c + 1
		for j in range(c - 1, -1, -1):
			if gu[j] == 1 and gv[j] == 0:
				k = k + 1
				break
			elif gu[j] == 0 and gv[j] == 1:
				break
		sum1 = 0
		sum2 = 0
		for j in range(c):
			if gu[j] == 1:
				sum1 = sum1 + 1
			if gv[j] == 1:
				sum2 = sum2 + 1
			if sum1 < sum2:
				k = k + 1
				break
		if k > 0:
			print('NO')
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


q = int(input().strip())
out = ''
AAA = 2 ** 30
for _ in range(q):
	(u, v) = map(int, input().strip().split())
	if u > v:
		out += 'NO\n'
	else:
		(U, V) = (bin(u + AAA), bin(v + AAA))
		(u_1, v_1) = (0, 0)
		for x in range(32, 2, -1):
			u_1 += U[x] == '1'
			v_1 += V[x] == '1'
			if u_1 < v_1:
				out += 'NO\n'
				break
		else:
			out += 'YES\n'
print(out)


import sys
pin = sys.stdin.readline
Q = int(pin())
for q in range(Q):
	(u, v) = map(int, pin().split())
	if u > v:
		print('NO')
	else:
		(u, v) = (bin(u)[2:][::-1], bin(v)[2:][::-1])
		if u.count('1') < v.count('1'):
			print('NO')
		else:
			F = 1
			S = 0
			for i in range(len(u)):
				if u[i] == v[i]:
					continue
				elif u[i] == '1':
					S += 1
				else:
					S -= 1
					if S < 0:
						F = 0
						break
			print(['NO', 'YES'][F])


def read_list() -> list:
	return [int(i) for i in input().strip().split()]

def read_num() -> int:
	return int(input().strip())

def check(u, v):
	(cnt_u, cnt_v) = (0, 0)
	for i in range(31):
		if u >> i & 1:
			cnt_u += 1
		if v >> i & 1:
			cnt_v += 1
		if cnt_v != 0:
			if cnt_u == 0:
				return False
			cnt_u -= 1
			cnt_v -= 1
	return True
q = read_num()
for _ in range(q):
	(u, v) = read_list()
	print('YES' if u <= v and check(u, v) else 'NO')


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	for _ in range(ii()):
		(a, b) = mi()
		if a > b:
			print('No')
			continue
		(c1, c2) = (0, 0)
		ok = True
		for i in range(31):
			if 1 << i & a:
				c1 += 1
			if 1 << i & b:
				c2 += 1
			if c2 > c1:
				print('No')
				ok = False
				break
		if ok:
			print('Yes')
if file:
	if path.exists('tmp/input.txt'):
		sys.stdin = open('tmp/input.txt', 'r')
		sys.stdout = open('tmp/output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


for _ in range(int(input())):
	(ui, vi) = map(int, input().split())
	if ui <= vi:
		uib = str(bin(ui)[2:]).rjust(31, '0')
		vib = str(bin(vi)[2:]).rjust(31, '0')
		nosu = 0
		nosv = 0
		for i in range(30, -1, -1):
			if nosu < nosv:
				print('NO')
				break
			if uib[i] == '1':
				nosu += 1
			if vib[i] == '1':
				nosv += 1
		else:
			print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(u, v) = map(int, input().split())
	fla = 1
	if u > v:
		print('NO')
		continue
	num1 = 0
	num2 = 0
	for i in range(32):
		if u & 1 << i:
			num1 += 1
		if v & 1 << i:
			num2 += 1
		if num1 < num2:
			fla = 0
	if fla:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	if l > r:
		print('NO')
	else:
		L = 0
		R = 0
		ok = True
		while l or r:
			if l & 1:
				L += 1
			l >>= 1
			if r & 1:
				R += 1
			r >>= 1
			if R > L:
				ok = False
		if ok:
			print('YES')
		else:
			print('NO')


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	input = sys.stdin.buffer.readline
	for _ in range(int(input())):
		(u, v) = map(int, input().split())
		if u > v:
			print('NO')
			continue
		u_bin = bin(u)[2:]
		v_bin = bin(v)[2:]
		if u_bin.count('1') < v_bin.count('1'):
			print('NO')
			continue
		L = len(v_bin)
		u_bin = u_bin.zfill(L)
		ok = 1
		cnt_01 = cnt_10 = 0
		for i in range(L - 1, -1, -1):
			if u_bin[i] == '0' and v_bin[i] == '1':
				cnt_01 += 1
			elif u_bin[i] == '1' and v_bin[i] == '0':
				cnt_10 += 1
			if cnt_01 > cnt_10:
				ok = 0
				break
		if ok:
			print('YES')
		else:
			print('NO')
main()


for _ in range(int(input())):
	(u, v) = list(map(int, input().split()))
	if u > v:
		print('NO')
	elif u == v:
		print('YES')
	else:
		fl = True
		u = bin(u)
		v = bin(v)
		u_o = 0
		v_o = 0
		diff = len(v) - len(u)
		for i in range(len(u) - 1, 1, -1):
			if u[i] == '1':
				u_o += 1
			if v[i + diff] == '1':
				v_o += 1
			if v_o > u_o:
				print('NO')
				fl = False
				break
		if fl:
			for i in range(2, 2 + diff):
				if v[i] == '1':
					v_o += 1
			if v_o > u_o:
				print('NO')
			else:
				print('YES')


import math

def getint():
	return [int(i) for i in input().split()]

def getstr():
	return [str(i) for i in input().split()]

def solve():
	(x, y) = getint()
	o = [0] * 35
	f = [0] * 35
	f1 = 1
	if x > y:
		print('NO')
	elif x == y:
		print('YES')
	else:
		for i in range(31):
			o[i] = x >> i & 1
		for i in range(1, 31):
			o[i] += o[i - 1]
		for i in range(31):
			f[i] = y >> i & 1
		for i in range(1, 31):
			f[i] += f[i - 1]
		for i in range(31):
			if o[i] < f[i]:
				f1 = 0
				break
		if f1:
			print('YES')
		else:
			print('NO')
for _ in range(int(input())):
	solve()


import math
q = int(input())
for i in range(q):
	(u, v) = [int(x) for x in input().split()]
	if u > v:
		print('NO')
		continue
	u_bits = 0
	v_bits = 0
	impossible = False
	for j in range(math.floor(math.log2(v)) + 1):
		if u & 1 << j:
			u_bits += 1
		if v & 1 << j:
			v_bits += 1
		if u_bits < v_bits:
			impossible = True
			break
	res = 'NO' if impossible else 'YES'
	print(res)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
md = 10 ** 9 + 7

def tolst(a):
	res = [0] * 30
	for i in range(30):
		res[i] = a & 1
		a >>= 1
	return res

def ok():
	if u > v:
		return False
	uu = tolst(u)
	vv = tolst(v)
	s = t = 0
	for (a, b) in zip(uu, vv):
		s += a
		t += b
		if v and s < t:
			return False
	return True
for _ in range(II()):
	(u, v) = MI()
	print('YES' if ok() else 'NO')


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(u, v) = I()
	pos = 0
	if u > v:
		pos = 1
	else:
		ps = 0
		i = 0
		while i < 32:
			cr = 1 << i
			if u & cr:
				ps += 1
			if v & cr:
				ps -= 1
			if ps < 0:
				pos = 1
				break
			i += 1
	print('YNEOS'[pos::2])


def solve(u, v):
	if u == v:
		return True
	if v % u == 0 and v // u & v // u - 1 == 0:
		return True
	if u > v:
		return False
	if u % 2 == 0 and v % 2 == 1:
		return False
	binU = format(u, 'b')
	binV = format(v, 'b')
	binULength = len(binU)
	binVLength = len(binV)
	uOnesCount = 0
	vOnesCount = 0
	for i in range(1, binVLength + 1):
		if i <= binULength:
			if binU[binULength - i] == '1':
				uOnesCount += 1
		if binV[binVLength - i] == '1':
			vOnesCount += 1
		if uOnesCount < vOnesCount:
			return False
	return True
q = int(input())
for i in range(q):
	(u, v) = map(int, input().split())
	result = solve(u, v)
	print('YES' if result else 'NO')


import os, sys, heapq as h, time
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInt():
	return int(input())

def getStrs():
	return input().split()

def getInts():
	return list(map(int, input().split()))

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 10 ** 9 + 7

def solve():
	(U, V) = getInts()
	if V < U:
		return 'NO'
	x1 = y1 = 0
	for i in range(30):
		x = 1 << i
		if U & x:
			x1 += 1
		if V & x:
			y1 += 1
		if x1 < y1:
			return 'NO'
	return 'YES'
for _ in range(getInt()):
	print(solve())


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'

def ceil(num, denom):
	return (num + denom - 1) // denom
input = sys.stdin.readline

def is_connec(a, b):
	if b < a:
		return False
	if bin(b)[2:].count('1') > bin(a)[2:].count('1'):
		return False
	count = 0
	for i in range(30):
		if a & 1 << i:
			count += 1
		if b & 1 << i:
			count -= 1
		if count < 0:
			return False
	return True
q = int(input())
for i in range(q):
	(u, v) = map(int, input().split())
	if is_connec(u, v):
		print('YES')
	else:
		print('NO')


def main():
	q = int(input())
	ans_list = []
	for _ in range(q):
		(u, v) = map(int, input().split(' '))
		if u > v:
			ans_list.append('NO')
		else:
			(set_bits_u, set_bits_v) = ([], [])
			for j in range(32):
				if 1 << j & u:
					set_bits_u.append(j)
				if 1 << j & v:
					set_bits_v.append(j)
			set_bits_u = set_bits_u[::-1]
			set_bits_v = set_bits_v[::-1]
			success = True
			while set_bits_v:
				if not set_bits_u or set_bits_u[-1] > set_bits_v[-1]:
					success = False
					break
				set_bits_v.pop()
				set_bits_u.pop()
			ans_list.append('YES' if success else 'NO')
	print('\n'.join(ans_list))
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.buffer.readline

def solve(u, v):
	ulist = list(map(int, '{:031b}'.format(u)))
	vlist = list(map(int, '{:031b}'.format(v)))
	su = sum(ulist)
	sv = sum(vlist)
	if su < sv:
		return False
	diff = su - sv
	cur = 0
	for (ub, vb) in zip(ulist, vlist):
		cur += vb - ub
		if cur < 0:
			return False
		spare = cur
		if spare > 0:
			spare = min(spare, diff)
			cur += spare
			diff -= spare
	return diff == 0
q = int(input())
answers = []
for _ in range(q):
	(u, v) = map(int, input().split())
	answers.append('YES' if solve(u, v) else 'NO')
print('\n'.join(answers))


def lsb(x):
	return x & -x
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split(' '))
	if a > b:
		print('NO')
	else:
		while b > 0:
			if lsb(b) < lsb(a) or a == 0:
				break
			a -= lsb(a)
			b -= lsb(b)
		else:
			print('YES')
			continue
		print('NO')


for s in [*open(0)][1:]:
	(u, v) = map(int, s.split())
	n = 0
	while u < v and n >= 0:
		n += u % 2 - v % 2
		v >>= 1
		u >>= 1
	print('NYOE S'[u == v and n >= 0::2])


import sys
input = sys.stdin.readline

def parse(x):
	out = []
	for i in range(29, -1, -1):
		if x >= 1 << i:
			out.append(i)
			x -= 1 << i
	return out
res = []
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		res.append('YES')
		continue
	p1 = parse(a)
	p2 = parse(b)
	if len(p2) > len(p1):
		res.append('NO')
		continue
	start = 0
	while len(p2) > start and p1[start] == p2[start]:
		start += 1
	p1 = p1[start:]
	p2 = p2[start:]
	if len(p2) == 0 or p2[0] < p1[0]:
		res.append('NO')
		continue
	assert p2[0] > p1[0]
	for i in range(len(p2) - 1):
		if p1[-i - 1] > p2[-i - 1]:
			res.append('NO')
			break
	else:
		res.append('YES')
print('\n'.join(res))


T = int(input())
for _ in range(T):
	(u, v) = map(int, input().split())
	if u > v:
		print('NO')
	else:
		s = bin(u).replace('0b', '')
		t = bin(v).replace('0b', '')
		s = s[::-1]
		t = t[::-1]
		s = s + '0' * (len(t) - len(s))
		n = len(t)
		cnt = 0
		flag = 0
		for i in range(n):
			if s[i] == '1':
				cnt = cnt + 1
			if t[i] == '1':
				if cnt == 0:
					flag = 1
					break
				cnt = cnt - 1
		if flag == 1:
			print('NO')
		else:
			print('YES')


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()

def FACT(n, mod):
	s = 1
	facts = [1]
	for i in range(1, n + 1):
		s *= i
		s %= mod
		facts.append(s)
	return facts[n]

def C(n, k, mod):
	return FACT(n, mod) * pow(FACT(k, mod) * FACT(n - k, mod) % mod, mod - 2, mod) % mod

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
q = II()
for _ in range(q):
	(u, v) = MI()
	boo = True
	x = list(bin(u))[2:]
	y = list(bin(v))[2:]
	m = max(len(x), len(y))
	x = ['0'] * (m - len(x)) + x
	y = ['0'] * (m - len(y)) + y
	c = 0
	if u > v:
		boo = False
	for i in range(m - 1, -1, -1):
		if x[i] == '1' and y[i] == '0':
			c += 1
		elif x[i] == '0' and y[i] == '1':
			x[i] = '1'
			c -= 1
		if c < 0:
			boo = False
			break
	print('YES' if boo else 'NO')


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda : list(map(int, sys.stdin.readline().rstrip('\r\n').split()))
mod = 10 ** 9 + 7
Mod = 998244353
INF = float('inf')
tc = 1
(tc,) = inp()
for _ in range(tc):
	(a, b) = inp()

	def lsb(x):
		return x & -x
	f = True
	if a > b:
		f = False
	while b > 0:
		if lsb(b) < lsb(a) or a == 0:
			f = False
			break
		a -= lsb(a)
		b -= lsb(b)
	print('YES' if f else 'NO')


def divisors(M):
	d = []
	i = 1
	while M >= i ** 2:
		if M % i == 0:
			d.append(i)
			if i ** 2 != M:
				d.append(M // i)
		i = i + 1
	return d

def popcount(x):
	x = x - (x >> 1 & 1431655765)
	x = (x & 858993459) + (x >> 2 & 858993459)
	x = x + (x >> 4) & 252645135
	x = x + (x >> 8)
	x = x + (x >> 16)
	return x & 127

def eratosthenes(n):
	res = [0 for i in range(n + 1)]
	prime = set([])
	for i in range(2, n + 1):
		if not res[i]:
			prime.add(i)
			for j in range(1, n // i + 1):
				res[i * j] = 1
	return prime

def factorization(n):
	res = []
	for p in prime:
		if n % p == 0:
			while n % p == 0:
				n //= p
			res.append(p)
	if n != 1:
		res.append(n)
	return res

def euler_phi(n):
	res = n
	for x in range(2, n + 1):
		if x ** 2 > n:
			break
		if n % x == 0:
			res = res // x * (x - 1)
			while n % x == 0:
				n //= x
	if n != 1:
		res = res // n * (n - 1)
	return res

def ind(b, n):
	res = 0
	while n % b == 0:
		res += 1
		n //= b
	return res

def isPrimeMR(n):
	d = n - 1
	d = d // (d & -d)
	L = [2, 3, 5, 7, 11, 13, 17]
	for a in L:
		t = d
		y = pow(a, t, n)
		if y == 1:
			continue
		while y != n - 1:
			y = y * y % n
			if y == 1 or t == n - 1:
				return 0
			t <<= 1
	return 1

def findFactorRho(n):
	from math import gcd
	m = 1 << n.bit_length() // 8
	for c in range(1, 99):
		f = lambda x: (x * x + c) % n
		(y, r, q, g) = (2, 1, 1, 1)
		while g == 1:
			x = y
			for i in range(r):
				y = f(y)
			k = 0
			while k < r and g == 1:
				ys = y
				for i in range(min(m, r - k)):
					y = f(y)
					q = q * abs(x - y) % n
				g = gcd(q, n)
				k += m
			r <<= 1
		if g == n:
			g = 1
			while g == 1:
				ys = f(ys)
				g = gcd(abs(x - ys), n)
		if g < n:
			if isPrimeMR(g):
				return g
			elif isPrimeMR(n // g):
				return n // g
			return findFactorRho(g)

def primeFactor(n):
	i = 2
	ret = {}
	rhoFlg = 0
	while i * i <= n:
		k = 0
		while n % i == 0:
			n //= i
			k += 1
		if k:
			ret[i] = k
		i += 1 + i % 2
		if i == 101 and n >= 2 ** 20:
			while n > 1:
				if isPrimeMR(n):
					(ret[n], n) = (1, 1)
				else:
					rhoFlg = 1
					j = findFactorRho(n)
					k = 0
					while n % j == 0:
						n //= j
						k += 1
					ret[j] = k
	if n > 1:
		ret[n] = 1
	if rhoFlg:
		ret = {x: ret[x] for x in sorted(ret)}
	return ret

def divisors(n):
	res = [1]
	prime = primeFactor(n)
	for p in prime:
		newres = []
		for d in res:
			for j in range(prime[p] + 1):
				newres.append(d * p ** j)
		res = newres
	res.sort()
	return res

def floor_sum(n: int, m: int, a: int, b: int) -> int:
	ans = 0
	if a >= m:
		ans += (n - 1) * n * (a // m) // 2
		a %= m
	if b >= m:
		ans += n * (b // m)
		b %= m
	y_max = (a * n + b) // m
	x_max = y_max * m - b
	if y_max == 0:
		return ans
	ans += (n - (x_max + a - 1) // a) * y_max
	ans += floor_sum(y_max, a, m, (a - x_max % a) % a)
	return ans

def xorfactorial(num):
	if num == 0:
		return 0
	elif num == 1:
		return 1
	elif num == 2:
		return 3
	elif num == 3:
		return 0
	else:
		x = baseorder(num)
		return 2 ** x * ((num - 2 ** x + 1) % 2) + function(num - 2 ** x)

def xorconv(n, X, Y):
	if n == 0:
		res = [X[0] * Y[0] % mod]
		return res
	x = [X[i] + X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	y = [Y[i] + Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	z = [X[i] - X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	w = [Y[i] - Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	res1 = xorconv(n - 1, x, y)
	res2 = xorconv(n - 1, z, w)
	former = [(res1[i] + res2[i]) * inv for i in range(2 ** (n - 1))]
	latter = [(res1[i] - res2[i]) * inv for i in range(2 ** (n - 1))]
	former = list(map(lambda x: x % mod, former))
	latter = list(map(lambda x: x % mod, latter))
	return former + latter

def merge_sort(A, B):
	(pos_A, pos_B) = (0, 0)
	(n, m) = (len(A), len(B))
	res = []
	while pos_A < n and pos_B < m:
		(a, b) = (A[pos_A], B[pos_B])
		if a < b:
			res.append(a)
			pos_A += 1
		else:
			res.append(b)
			pos_B += 1
	res += A[pos_A:]
	res += B[pos_B:]
	return res

class UnionFindVerSize:

	def __init__(self, N):
		self._parent = [n for n in range(0, N)]
		self._size = [1] * N
		self.group = N

	def find_root(self, x):
		if self._parent[x] == x:
			return x
		self._parent[x] = self.find_root(self._parent[x])
		stack = [x]
		while self._parent[stack[-1]] != stack[-1]:
			stack.append(self._parent[stack[-1]])
		for v in stack:
			self._parent[v] = stack[-1]
		return self._parent[x]

	def unite(self, x, y):
		gx = self.find_root(x)
		gy = self.find_root(y)
		if gx == gy:
			return
		self.group -= 1
		if self._size[gx] < self._size[gy]:
			self._parent[gx] = gy
			self._size[gy] += self._size[gx]
		else:
			self._parent[gy] = gx
			self._size[gx] += self._size[gy]

	def get_size(self, x):
		return self._size[self.find_root(x)]

	def is_same_group(self, x, y):
		return self.find_root(x) == self.find_root(y)

class WeightedUnionFind:

	def __init__(self, N):
		self.parent = [i for i in range(N)]
		self.size = [1 for i in range(N)]
		self.val = [0 for i in range(N)]
		self.flag = True
		self.edge = [[] for i in range(N)]

	def dfs(self, v, pv):
		stack = [(v, pv)]
		new_parent = self.parent[pv]
		while stack:
			(v, pv) = stack.pop()
			self.parent[v] = new_parent
			for (nv, w) in self.edge[v]:
				if nv != pv:
					self.val[nv] = self.val[v] + w
					stack.append((nv, v))

	def unite(self, x, y, w):
		if not self.flag:
			return
		if self.parent[x] == self.parent[y]:
			self.flag = self.val[x] - self.val[y] == w
			return
		if self.size[self.parent[x]] > self.size[self.parent[y]]:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[x] += self.size[y]
			self.val[y] = self.val[x] - w
			self.dfs(y, x)
		else:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[y] += self.size[x]
			self.val[x] = self.val[y] + w
			self.dfs(x, y)

class Dijkstra:

	class Edge:

		def __init__(self, _to, _cost):
			self.to = _to
			self.cost = _cost

	def __init__(self, V):
		self.G = [[] for i in range(V)]
		self._E = 0
		self._V = V

	@property
	def E(self):
		return self._E

	@property
	def V(self):
		return self._V

	def add_edge(self, _from, _to, _cost):
		self.G[_from].append(self.Edge(_to, _cost))
		self._E += 1

	def shortest_path(self, s):
		import heapq
		inf = float('inf')
		que = []
		d = [inf] * self.V
		d[s] = 0
		heapq.heappush(que, (0, s))
		while len(que) != 0:
			(cost, v) = heapq.heappop(que)
			if d[v] < cost:
				continue
			for i in range(len(self.G[v])):
				e = self.G[v][i]
				if d[e.to] > d[v] + e.cost:
					d[e.to] = d[v] + e.cost
					heapq.heappush(que, (d[e.to], e.to))
		return d

def Z_algorithm(s):
	N = len(s)
	Z_alg = [0] * N
	Z_alg[0] = N
	i = 1
	j = 0
	while i < N:
		while i + j < N and s[j] == s[i + j]:
			j += 1
		Z_alg[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < N and k + Z_alg[k] < j:
			Z_alg[i + k] = Z_alg[k]
			k += 1
		i += k
		j -= k
	return Z_alg

class BIT:

	def __init__(self, n):
		self.BIT = [0] * (n + 1)
		self.num = n

	def query(self, idx):
		res_sum = 0
		while idx > 0:
			res_sum += self.BIT[idx]
			idx -= idx & -idx
		return res_sum

	def update(self, idx, x):
		while idx <= self.num:
			self.BIT[idx] += x
			idx += idx & -idx
		return

class dancinglink:

	def __init__(self, n, debug=False):
		self.n = n
		self.debug = debug
		self._left = [i - 1 for i in range(n)]
		self._right = [i + 1 for i in range(n)]
		self.exist = [True for i in range(n)]

	def pop(self, k):
		if self.debug:
			assert self.exist[k]
		L = self._left[k]
		R = self._right[k]
		if L != -1:
			if R != self.n:
				(self._right[L], self._left[R]) = (R, L)
			else:
				self._right[L] = self.n
		elif R != self.n:
			self._left[R] = -1
		self.exist[k] = False

	def left(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._left[res]
			if res == -1:
				break
			k -= 1
		return res

	def right(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._right[res]
			if res == self.n:
				break
			k -= 1
		return res

class SparseTable:

	def __init__(self, A, merge_func, ide_ele):
		N = len(A)
		n = N.bit_length()
		self.table = [[ide_ele for i in range(n)] for i in range(N)]
		self.merge_func = merge_func
		for i in range(N):
			self.table[i][0] = A[i]
		for j in range(1, n):
			for i in range(0, N - 2 ** j + 1):
				f = self.table[i][j - 1]
				s = self.table[i + 2 ** (j - 1)][j - 1]
				self.table[i][j] = self.merge_func(f, s)

	def query(self, s, t):
		b = t - s + 1
		m = b.bit_length() - 1
		return self.merge_func(self.table[s][m], self.table[t - 2 ** m + 1][m])

class BinaryTrie:

	class node:

		def __init__(self, val):
			self.left = None
			self.right = None
			self.max = val

	def __init__(self):
		self.root = self.node(-10 ** 15)

	def append(self, key, val):
		pos = self.root
		for i in range(29, -1, -1):
			pos.max = max(pos.max, val)
			if key >> i & 1:
				if pos.right is None:
					pos.right = self.node(val)
					pos = pos.right
				else:
					pos = pos.right
			elif pos.left is None:
				pos.left = self.node(val)
				pos = pos.left
			else:
				pos = pos.left
		pos.max = max(pos.max, val)

	def search(self, M, xor):
		res = -10 ** 15
		pos = self.root
		for i in range(29, -1, -1):
			if pos is None:
				break
			if M >> i & 1:
				if xor >> i & 1:
					if pos.right:
						res = max(res, pos.right.max)
					pos = pos.left
				else:
					if pos.left:
						res = max(res, pos.left.max)
					pos = pos.right
			elif xor >> i & 1:
				pos = pos.right
			else:
				pos = pos.left
		if pos:
			res = max(res, pos.max)
		return res

def solveequation(edge, ans, n, m):
	x = [0] * m
	used = [False] * n
	for v in range(n):
		if used[v]:
			continue
		y = dfs(v)
		if y != 0:
			return False
	return x

	def dfs(v):
		used[v] = True
		r = ans[v]
		for (to, dire, id) in edge[v]:
			if used[to]:
				continue
			y = dfs(to)
			if dire == -1:
				x[id] = y
			else:
				x[id] = -y
			r += y
		return r

class Matrix:
	mod = 10 ** 9 + 7

	def set_mod(m):
		Matrix.mod = m

	def __init__(self, L):
		self.row = len(L)
		self.column = len(L[0])
		self._matrix = L
		for i in range(self.row):
			for j in range(self.column):
				self._matrix[i][j] %= Matrix.mod

	def __getitem__(self, item):
		if type(item) == int:
			raise IndexError('you must specific row and column')
		elif len(item) != 2:
			raise IndexError('you must specific row and column')
		(i, j) = item
		return self._matrix[i][j]

	def __setitem__(self, item, val):
		if type(item) == int:
			raise IndexError('you must specific row and column')
		elif len(item) != 2:
			raise IndexError('you must specific row and column')
		(i, j) = item
		self._matrix[i][j] = val

	def __add__(self, other):
		if (self.row, self.column) != (other.row, other.column):
			raise SizeError('sizes of matrixes are different')
		res = [[0 for j in range(self.column)] for i in range(self.row)]
		for i in range(self.row):
			for j in range(self.column):
				res[i][j] = self._matrix[i][j] + other._matrix[i][j]
				res[i][j] %= Matrix.mod
		return Matrix(res)

	def __sub__(self, other):
		if (self.row, self.column) != (other.row, other.column):
			raise SizeError('sizes of matrixes are different')
		res = [[0 for j in range(self.column)] for i in range(self.row)]
		for i in range(self.row):
			for j in range(self.column):
				res[i][j] = self._matrix[i][j] - other._matrix[i][j]
				res[i][j] %= Matrix.mod
		return Matrix(res)

	def __mul__(self, other):
		if type(other) != int:
			if self.column != other.row:
				raise SizeError('sizes of matrixes are different')
			res = [[0 for j in range(other.column)] for i in range(self.row)]
			for i in range(self.row):
				for j in range(other.column):
					temp = 0
					for k in range(self.column):
						temp += self._matrix[i][k] * other._matrix[k][j]
					res[i][j] = temp % Matrix.mod
			return Matrix(res)
		else:
			n = other
			res = [[n * self._matrix[i][j] % Matrix.mod for j in range(self.column)] for i in range(self.row)]
			return Matrix(res)

	def __pow__(self, m):
		if self.column != self.row:
			raise MatrixPowError('the size of row must be the same as that of column')
		n = self.row
		res = Matrix([[int(i == j) for i in range(n)] for j in range(n)])
		while m:
			if m % 2 == 1:
				res = res * self
			self = self * self
			m //= 2
		return res

	def __str__(self):
		res = []
		for i in range(self.row):
			for j in range(self.column):
				res.append(str(self._matrix[i][j]))
				res.append(' ')
			res.append('\n')
		res = res[:len(res) - 1]
		return ''.join(res)

class SegmentTree:

	def __init__(self, init_val, segfunc, ide_ele):
		n = len(init_val)
		self.segfunc = segfunc
		self.ide_ele = ide_ele
		self.num = 1 << (n - 1).bit_length()
		self.tree = [ide_ele] * 2 * self.num
		for i in range(n):
			self.tree[self.num + i] = init_val[i]
		for i in range(self.num - 1, 0, -1):
			self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

	def update(self, k, x):
		k += self.num
		self.tree[k] = x
		while k > 1:
			self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
			k >>= 1

	def query(self, l, r):
		res = self.ide_ele
		l += self.num
		r += self.num
		while l < r:
			if l & 1:
				res = self.segfunc(res, self.tree[l])
				l += 1
			if r & 1:
				res = self.segfunc(res, self.tree[r - 1])
			l >>= 1
			r >>= 1
		return res

	def bisect_l(self, l, r, x):
		l += self.num
		r += self.num
		Lmin = -1
		Rmin = -1
		while l < r:
			if l & 1:
				if self.tree[l] <= x and Lmin == -1:
					Lmin = l
				l += 1
			if r & 1:
				if self.tree[r - 1] <= x:
					Rmin = r - 1
			l >>= 1
			r >>= 1
		if Lmin != -1:
			pos = Lmin
			while pos < self.num:
				if self.tree[2 * pos] <= x:
					pos = 2 * pos
				else:
					pos = 2 * pos + 1
			return pos - self.num
		elif Rmin != -1:
			pos = Rmin
			while pos < self.num:
				if self.tree[2 * pos] <= x:
					pos = 2 * pos
				else:
					pos = 2 * pos + 1
			return pos - self.num
		else:
			return -1

class DualSegmentTree:

	def __init__(self, n, segfunc, ide_ele):
		self.segfunc = segfunc
		self.ide_ele = ide_ele
		self.num = 1 << (n - 1).bit_length()
		self.tree = [ide_ele] * 2 * self.num

	def update(self, l, r, x):
		l += self.num
		r += self.num
		while l < r:
			if l & 1:
				self.tree[l] = self.segfunc(self.tree[l], x)
				l += 1
			if r & 1:
				self.tree[r - 1] = self.segfunc(self.tree[r - 1], x)
			l >>= 1
			r >>= 1

	def __getitem__(self, idx):
		idx += self.num
		res = self.ide_ele
		while idx:
			res = self.segfunc(res, self.tree[idx])
			idx >>= 1
		return res

class LazySegmentTree:
	__slots__ = ['merge', 'merge_unit', 'operate', 'merge_operate', 'operate_unit', 'n', 'data', 'lazy']

	def __init__(self, n, init, merge, merge_unit, operate, merge_operate, operate_unit):
		self.merge = merge
		self.merge_unit = merge_unit
		self.operate = operate
		self.merge_operate = merge_operate
		self.operate_unit = operate_unit
		self.n = (n - 1).bit_length()
		self.data = [merge_unit for i in range(1 << self.n + 1)]
		self.lazy = [operate_unit for i in range(1 << self.n + 1)]
		if init:
			for i in range(n):
				self.data[2 ** self.n + i] = init[i]
			for i in range(2 ** self.n - 1, 0, -1):
				self.data[i] = self.merge(self.data[2 * i], self.data[2 * i + 1])

	def propagate(self, v):
		ope = self.lazy[v]
		if ope == self.operate_unit:
			return
		self.lazy[v] = self.operate_unit
		self.data[v << 1] = self.operate(self.data[v << 1], ope)
		self.data[(v << 1) + 1] = self.operate(self.data[(v << 1) + 1], ope)
		self.lazy[v << 1] = self.merge_operate(self.lazy[v << 1], ope)
		self.lazy[(v << 1) + 1] = self.merge_operate(self.lazy[(v << 1) + 1], ope)

	def propagate_above(self, i):
		m = i.bit_length() - 1
		for bit in range(m, 0, -1):
			v = i >> bit
			self.propagate(v)

	def remerge_above(self, i):
		while i:
			c = self.merge(self.data[i], self.data[i ^ 1])
			i >>= 1
			self.data[i] = self.operate(c, self.lazy[i])

	def update(self, l, r, x):
		l += 1 << self.n
		r += 1 << self.n
		l0 = l // (l & -l)
		r0 = r // (r & -r) - 1
		self.propagate_above(l0)
		self.propagate_above(r0)
		while l < r:
			if l & 1:
				self.data[l] = self.operate(self.data[l], x)
				self.lazy[l] = self.merge_operate(self.lazy[l], x)
				l += 1
			if r & 1:
				self.data[r - 1] = self.operate(self.data[r - 1], x)
				self.lazy[r - 1] = self.merge_operate(self.lazy[r - 1], x)
			l >>= 1
			r >>= 1
		self.remerge_above(l0)
		self.remerge_above(r0)

	def query(self, l, r):
		l += 1 << self.n
		r += 1 << self.n
		l0 = l // (l & -l)
		r0 = r // (r & -r) - 1
		self.propagate_above(l0)
		self.propagate_above(r0)
		res = self.merge_unit
		while l < r:
			if l & 1:
				res = self.merge(res, self.data[l])
				l += 1
			if r & 1:
				res = self.merge(res, self.data[r - 1])
			l >>= 1
			r >>= 1
		return res

	def bisect_l(self, l, r, x):
		l += 1 << self.n
		r += 1 << self.n
		l0 = l // (l & -l)
		r0 = r // (r & -r) - 1
		self.propagate_above(l0)
		self.propagate_above(r0)
		Lmin = -1
		Rmin = -1
		while l < r:
			if l & 1:
				if self.data[l][0] <= x and Lmin == -1:
					Lmin = l
				l += 1
			if r & 1:
				if self.data[r - 1][0] <= x:
					Rmin = r - 1
			l >>= 1
			r >>= 1
		res = -1
		if Lmin != -1:
			pos = Lmin
			while pos < self.num:
				self.propagate(pos)
				if self.data[2 * pos][0] <= x:
					pos = 2 * pos
				else:
					pos = 2 * pos + 1
			res = pos - self.num
		if Rmin != -1:
			pos = Rmin
			while pos < self.num:
				self.propagate(pos)
				if self.data[2 * pos][0] <= x:
					pos = 2 * pos
				else:
					pos = 2 * pos + 1
			if res == -1:
				res = pos - self.num
			else:
				res = min(res, pos - self.num)
		return res

def floor_sum(n: int, m: int, a: int, b: int) -> int:
	ans = 0
	if a >= m:
		ans += (n - 1) * n * (a // m) // 2
		a %= m
	if b >= m:
		ans += n * (b // m)
		b %= m
	y_max = (a * n + b) // m
	x_max = y_max * m - b
	if y_max == 0:
		return ans
	ans += (n - (x_max + a - 1) // a) * y_max
	ans += floor_sum(y_max, a, m, (a - x_max % a) % a)
	return ans

def _inv_gcd(a, b):
	a %= b
	if a == 0:
		return (b, 0)
	s = b
	t = a
	m0 = 0
	m1 = 1
	while t:
		u = s // t
		s -= t * u
		m0 -= m1 * u
		(s, t) = (t, s)
		(m0, m1) = (m1, m0)
	if m0 < 0:
		m0 += b // s
	return (s, m0)

def crt(r, m):
	assert len(r) == len(m)
	n = len(r)
	r0 = 0
	m0 = 1
	for i in range(n):
		assert 1 <= m[i]
		r1 = r[i] % m[i]
		m1 = m[i]
		if m0 < m1:
			(r0, r1) = (r1, r0)
			(m0, m1) = (m1, m0)
		if m0 % m1 == 0:
			if r0 % m1 != r1:
				return (0, 0)
			continue
		(g, im) = _inv_gcd(m0, m1)
		u1 = m1 // g
		if (r1 - r0) % g:
			return (0, 0)
		x = (r1 - r0) // g % u1 * im % u1
		r0 += x * m0
		m0 *= u1
		if r0 < 0:
			r0 += m0
	return (r0, m0)
import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import log, gcd
input = lambda : sys.stdin.buffer.readline()
mi = lambda : map(int, input().split())
li = lambda : list(mi())

def solve(u, v):
	a = [i for i in range(30) if u >> i & 1]
	b = [i for i in range(30) if v >> i & 1]
	a = a[::-1]
	b = b[::-1]
	if len(a) < len(b):
		return False
	if len(a) > len(b):
		for j in range(len(b)):
			if b[j] > a[j]:
				a[j] += 1
				a = a[:j + 1] + a[j + 1 + len(a) - len(b):len(a)]
				break
		else:
			return False
	for j in range(len(b) - 1, -1, -1):
		if b[j] < a[j]:
			return False
	else:
		return True
for _ in range(int(input())):
	(u, v) = mi()
	print('YES' if solve(u, v) else 'NO')


import os
import sys
from io import BytesIO, IOBase

def solve(x, y):
	if x > y:
		return 'NO'
	y = bin(y)[2:]
	lby = len(y)
	x = bin(x)[2:].zfill(lby)
	c = 0
	for i in range(lby - 1, -1, -1):
		if x[i] != y[i]:
			if y[i] == '1':
				c -= 1
			else:
				c += 1
		if c < 0:
			return 'NO'
	return 'YES'

def main():
	for _ in range(int(input())):
		(x, y) = map(int, input().split())
		print(solve(x, y))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def check(u, v):
	a = 0
	b = 0
	for i in range(31):
		if u >> i & 1:
			a += 1
		if v >> i & 1:
			b += 1
		if b > 0:
			if a <= 0:
				return 0
			a -= 1
			b -= 1
	return 1
T = int(input())
while T > 0:
	T -= 1
	(u, v) = map(int, input().split())
	if u <= v and check(u, v) == 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.buffer.readline
for i in range(int(input())):
	(u, v) = map(int, input().split())
	gu = []
	gv = []
	c = 0
	k = 0
	while u > 0 or v > 0:
		gu.append(u % 2)
		gv.append(v % 2)
		u = u // 2
		v = v // 2
		c = c + 1
	for j in range(c - 1, -1, -1):
		if gu[j] == 1 and gv[j] == 0:
			k = k + 1
			break
		elif gu[j] == 0 and gv[j] == 1:
			break
	sum1 = 0
	sum2 = 0
	for j in range(c):
		if gu[j] == 1:
			sum1 = sum1 + 1
		if gv[j] == 1:
			sum2 = sum2 + 1
		if sum1 < sum2:
			k = k + 1
			break
	if k > 0:
		print('NO')
	else:
		print('YES')


import sys
(*data,) = sys.stdin.read().split('\n')[::-1]

def input():
	return data.pop()

def fprint(*args, **kwargs):
	print(*args, **kwargs, flush=True)

def eprint(*args, **kwargs):
	print(*args, **kwargs, file=sys.stderr)
for _ in range(int(input())):
	(src, dst) = map(int, input().split())
	if src <= dst:
		spare = 0
		while dst:
			if src & 1:
				spare += 1
			src //= 2
			if dst & 1 and (not spare):
				break
			if dst & 1:
				spare -= 1
			dst //= 2
	print('YES' if not dst else 'NO')


import sys
import math

def is_true(a, b):
	if a > b:
		return False
	else:
		while b > 0:
			if lsb(b) < lsb(a) or a == 0:
				return False
			a -= lsb(a)
			b -= lsb(b)
		return True

def lsb(num):
	return num & -num
q = int(sys.stdin.readline())
for _ in range(q):
	(u, v) = list(map(int, sys.stdin.readline().split()))
	if is_true(u, v):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if b < a:
		print('NO')
	else:
		c = str(bin(a))[2:]
		d = str(bin(b))[2:]
		e = 0
		f = 0
		g = len(c)
		h = len(d)
		x = 0
		for k in range(h):
			if k < g and c[g - k - 1] == '1':
				e += 1
			if d[h - k - 1] == '1':
				f += 1
			if f > e:
				x = 1
				break
		if x == 0:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
flush = sys.stdout.flush
from collections import Counter
for _ in range(int(input())):
	(u, v) = map(int, input().split())
	if u > v:
		print('NO')
		continue
	if u == v:
		print('YES')
		continue
	d = v - u
	for i in range(30, -1, -1):
		b = u & 1 << i
		if b:
			while d >= b:
				d -= b
				b <<= 1
	if not d:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(u, v) = map(int, input().split())
	x = bin(u)[2:]
	y = bin(v)[2:]
	(n, m) = (len(x), len(y))
	if v < u or x.count('1') < y.count('1'):
		print('No')
	else:
		ok = True
		count = 0
		for i in range(n):
			count += int(x[-i])
			count -= int(y[-i])
			if count < 0:
				ok = False
				break
		if ok:
			print('Yes')
		else:
			print('No')


d = int(input())
for d in range(d):
	(u, v) = [int(x) for x in input().split()]
	if u > v:
		print('NO')
	else:
		ucount = bin(u).count('1')
		vcount = bin(v).count('1')
		if ucount < vcount:
			print('NO')
		else:
			(uu, vv) = (0, 0)
			for i in range(32):
				if u >> i & 1:
					uu += 1
				if v >> i & 1:
					vv += 1
				if uu < vv:
					print('NO')
					break
			else:
				print('YES')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if bin(n).count('1') >= bin(m).count('1') and n <= m:
		A = []
		B = []
		sa = bin(n)
		sb = bin(m)
		for i in range(len(sa)):
			if sa[-i - 1] == '1':
				A.append(i)
		for i in range(len(sb)):
			if sb[-i - 1] == '1':
				B.append(i)
		tr = True
		for i in range(len(B)):
			if A[i] > B[i]:
				tr = False
				break
		if tr:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def some_random_function():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function5():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
import os, sys
from io import BytesIO, IOBase

def solve(u, v):
	if u > v:
		return 'No'
	v = bin(v)[2:]
	u = bin(u)[2:].zfill(len(v))
	cou = 0
	for i in range(len(v) - 1, -1, -1):
		if u[i] == v[i]:
			continue
		if v[i] == '1':
			if not cou:
				return 'No'
			cou -= 1
		else:
			cou += 1
	return 'Yes'

def main():
	for _ in range(int(input())):
		(u, v) = map(int, input().split())
		print(solve(u, v))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def some_random_function1():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function2():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function3():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function4():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function6():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function7():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function8():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline()

def RL():
	return map(int, sys.stdin.readline().split())

def RLL():
	return list(map(int, sys.stdin.readline().split()))

def N():
	return int(input())

def S():
	return input().strip()

def print_list(l):
	print(' '.join(map(str, l)))
for _ in range(N()):
	(a, b) = RL()
	if a > b:
		print('NO')
		continue
	(x, y, k) = (0, 0, 1)
	while k <= b:
		if k & a:
			x += 1
		if k & b:
			y += 1
		if y > x:
			print('NO')
			break
		k <<= 1
	else:
		print('YES')


def main():

	def lsb(x):
		return x & -x
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split(' '))
		if a > b:
			print('NO')
		else:
			can = True
			while b > 0:
				if lsb(b) < lsb(a) or a == 0:
					can = False
					break
				a -= lsb(a)
				b -= lsb(b)
			print('YES' if can else 'NO')
main()


t = int(input())
for _ in range(t):
	(u, v) = tuple(map(int, input().split()))
	if v < u:
		print('NO')
		continue
	ustr = format(u, 'b')
	vstr = format(v, 'b')
	ustr = str(ustr[::-1]) + '0' * (len(vstr) - len(ustr))
	vstr = str(vstr[::-1])
	maxCarry = 0
	carry = False
	for (cu, cv) in zip(ustr, vstr):
		if cu == '0' and cv == '1':
			maxCarry -= 1
			if maxCarry < 0:
				break
			carry = False
		if cu == '1' and cv == '0':
			carry = True
			maxCarry += 1
	if not carry and maxCarry >= 0:
		print('YES')
	else:
		print('NO')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
n = int(input())
for i in range(n):
	(f, t) = list(map(int, input().split()))
	if f > t:
		print('NO')
	elif f == t:
		print('YES')
	elif f & 1 == 0 and t & 1:
		print('NO')
	else:
		binf = bin(f)[2:]
		bint = bin(t)[2:]
		ans = 'YES'
		n = len(bint)
		binf = '0' * (n - len(binf)) + binf
		currSum = 0
		for i in range(n):
			if bint[n - i - 1] == '1':
				currSum += 1
			if binf[n - i - 1] == '1':
				currSum -= 1
			if currSum > 0:
				ans = 'NO'
				break
		if bint.count('1') > binf.count('1'):
			print('NO')
		else:
			print(ans)


import sys, math
import io, os
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.buffer.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
mod = int(1000000000.0) + 7
for q in range(int(data())):
	(u, v) = mdata()
	(k, l) = (0, 0)
	flag = True
	if u > v:
		out('NO')
		continue
	for i in range(31):
		a = 1 << i
		k += a & v != 0
		l += a & u != 0
		if k > l:
			flag = False
			break
	if flag:
		out('YES')
	else:
		out('NO')


import sys
input = sys.stdin.readline
q = int(input())
for i in range(q):
	(x, y) = map(int, input().split())
	X = []
	Y = []
	for i in range(31, -1, -1):
		if x & 1 << i != 0:
			X.append(i)
		if y & 1 << i != 0:
			Y.append(i)
	if len(X) < len(Y):
		print('NO')
	elif len(X) == len(Y):
		for j in range(len(X)):
			if X[j] <= Y[j]:
				True
			else:
				print('NO')
				break
		else:
			print('YES')
	else:
		flag = 0
		for j in range(len(Y)):
			if Y[j] > X[j]:
				flag = 1
				break
			if Y[j] < X[j]:
				flag = -1
				break
		if flag == -1 or flag == 0:
			print('NO')
			continue
		indx = 0
		for j in range(len(Y)):
			if indx == len(X):
				print('NO')
				break
			while X[indx] > Y[j]:
				indx += 1
				if indx == len(X):
					break
			if indx == len(X):
				print('NO')
				break
			else:
				indx += 1
		else:
			print('YES')


from sys import stdin, gettrace
if gettrace():

	def inputi():
		return input()
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	(u, v) = map(int, input().split())
	if v < u:
		print('NO')
		return
	bu = 0
	bv = 0
	while u > 0 or v > 0:
		bu += u & 1
		bv += v & 1
		if bv > bu:
			print('NO')
			return
		u >>= 1
		v >>= 1
	print('YES')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


q = int(input())
for qw in range(q):
	(x, y) = [int(x) for x in input().split()]
	if x > y:
		print('No')
		continue
	sx = 0
	sy = 0
	ans = 'Yes'
	while y > 0:
		sx += x % 2
		sy += y % 2
		if sx < sy:
			ans = 'No'
		x //= 2
		y //= 2
	print(ans)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(u, v) = map(int, input().split())
	pu = 0
	pv = 0
	tu = []
	tv = []
	for i in range(31, -1, -1):
		if u >> i & 1:
			pu += 1
			tu.append(i)
		if v >> i & 1:
			pv += 1
			tv.append(i)
	dp = [[0] * (pv + 1) for _ in range(pu + 1)]
	dp[0][0] = 1
	for i in range(pu):
		for j in range(pv):
			if tu[i] < tv[j]:
				for k in range(i + 1, pu + 1):
					dp[k][j + 1] |= dp[i][j]
			if tu[i] <= tv[j]:
				dp[i + 1][j + 1] |= dp[i][j]
	if dp[pu][pv]:
		print('YES')
	else:
		print('NO')


from sys import *
from collections import *
input = stdin.readline
for _ in range(int(input())):
	(ui, vi) = map(int, input().split())
	if vi < ui:
		print('NO')
	else:
		ui = bin(ui)[2:].rjust(31, '0')
		vi = bin(vi)[2:].rjust(31, '0')
		(ct1, ct2) = (0, 0)
		for i in range(30, -1, -1):
			if ct2 > ct1:
				print('NO')
				break
			else:
				if ui[i] == '1':
					ct1 += 1
				if vi[i] == '1':
					ct2 += 1
		else:
			print('YES')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(u, v) = map(int, input().split())
	if u == v:
		print('YES')
		continue
	res = 'NO'
	if not (u <= v and bin(u).count('1') >= bin(v).count('1')):
		print('NO')
		continue
	while u < v:
		while u & 1 == v & 1:
			u //= 2
			v //= 2
		if not v or u & 1 < v & 1:
			break
		(x, y) = (u, 0)
		while x & 1 and u + 2 * y + 1 <= v:
			x //= 2
			y *= 2
			y += 1
		u += y
	if u == v:
		res = 'YES'
	print(res)


import sys
from sys import stdin
tt = int(stdin.readline())
ans = []
for loop in range(tt):
	(u, v) = map(int, stdin.readline().split())
	if u > v:
		ans.append('NO')
		continue
	asum = 0
	bsum = 0
	flag = True
	for i in range(31):
		if 2 ** i & u > 0:
			asum += 1
		if 2 ** i & v > 0:
			bsum += 1
		if asum < bsum:
			flag = False
			break
	if flag:
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if b == a:
		print('YES')
		continue
	if b < a:
		print('NO')
		continue
	works = True
	aCount = 0
	bCount = 0
	i = 0
	c = 1 << i
	while c <= b:
		if b & c:
			bCount += 1
		if a & c:
			aCount += 1
		if bCount > aCount:
			works = False
			break
		i += 1
		c = 1 << i
	if not works:
		print('NO')
	else:
		print('YES')