You are given two positive integers $x$ and $y$. You can perform the following operation with $x$: write it in its binary form without leading zeros, add $0$ or $1$ to the right of it, reverse the binary form and turn it into a decimal number which is assigned as the new value of $x$.

For example:

$34$ can be turned into $81$ via one operation: the binary form of $34$ is $100010$, if you add $1$, reverse it and remove leading zeros, you will get $1010001$, which is the binary form of $81$.

$34$ can be turned into $17$ via one operation: the binary form of $34$ is $100010$, if you add $0$, reverse it and remove leading zeros, you will get $10001$, which is the binary form of $17$.

$81$ can be turned into $69$ via one operation: the binary form of $81$ is $1010001$, if you add $0$, reverse it and remove leading zeros, you will get $1000101$, which is the binary form of $69$.

$34$ can be turned into $69$ via two operations: first you turn $34$ into $81$ and then $81$ into $69$.

Your task is to find out whether $x$ can be turned into $y$ after a certain number of operations (possibly zero).


-----Input-----

The only line of the input contains two integers $x$ and $y$ ($1 \le x, y \le 10^{18}$).


-----Output-----

Print YES if you can make $x$ equal to $y$ and NO if you can't.


-----Examples-----

Input
3 3
Output
YES
Input
7 4
Output
NO
Input
2 8
Output
NO
Input
34 69
Output
YES
Input
8935891487501725 71487131900013807
Output
YES


-----Note-----

In the first example, you don't even need to do anything.

The fourth example is described in the statement.

Source: codeforces | Difficulty: HARD
Tags: Bit manipulation

Graph traversal

Constructive algorithms

String algorithms

Implementation

Mathematics


Solutions:
import re
(x, y) = map(int, input().strip().split())
bx = bin(x)[2:]
by = bin(y)[2:]
if bx == by:
	print('YES')
else:
	bxf = bx
	bx = bx.strip('0')
	r = [1, 1, 1, 1]
	r[0] = re.compile('^1*' + bx + '1*$')
	r[1] = re.compile('^1*' + bx[::-1] + '1*$')
	r[2] = re.compile('^1*' + bxf + '11*$')
	r[3] = re.compile('^1*1' + bxf[::-1] + '1*$')
	don = False
	for rr in r:
		if rr.match(by) and (not don):
			print('YES')
			don = True
	if not don:
		print('NO')


import re
(a, b) = [int(i) for i in input().split()]

def binSlice(x):
	return bin(x)[2:]

def removeLeadingZeros(s):
	for k in range(len(s)):
		if s[k] != '0':
			break
	return s[k:]

def reversed(s):
	return s[::-1]
temp = reversed(binSlice(a))
temp2 = removeLeadingZeros(temp)
check = re.fullmatch(f'1*(1{temp}|{temp2}|{reversed(temp)}1|{reversed(temp2)})1*', binSlice(b)) is not None
print('YES' if check or a == b else 'NO')


(a, b) = list(map(int, input().strip().split()))
stra = '{0:b}'.format(a)
strb = '{0:b}'.format(b)
stra1 = stra + '1'
strar = stra[::-1].strip('0')
strar1 = stra1[::-1].strip('0')
strsa = [stra.strip('0'), stra1, strar, strar1]
ans = stra == strb
for string in strsa:
	pos = strb.find(string)
	if pos == -1:
		continue
	b = strb[:pos] + strb[pos + len(string):]
	if b == '1' * len(b):
		ans = True
		break
print('YES' if ans else 'NO')


(a, b) = map(int, input().split())
s = bin(b)[2:]
t = bin(a)[2:]
if s == t:
	print('YES')
	exit(0)
for q in [t + '1', t.strip('0')]:
	for l in range(len(s) - len(q) + 1):
		r = len(s) - len(q) - l
		if '1' * l + q + '1' * r == s or '1' * l + q[::-1] + '1' * r == s:
			print('YES')
			exit(0)
print('NO')


from math import log2
(x, y) = map(lambda p: bin(int(p))[2:], input().split())
(rx, rx2, rx3) = (bin(int(x[::-1], 2))[2:], '1' + x[::-1], bin(int(x, 2) >> int(log2(int(x, 2) & -int(x, 2))))[2:])
if y in [x, rx, rx2, rx3]:
	print('YES')
	exit(0)
(f1, f2, f3, f4) = (y.find(x), y.find(rx), y.find(rx2), y.find(rx3))
x = [x, rx, rx2, rx3]
f = [f1, f2, f3, f4]
for i in range(4):
	(ff, xx) = (f[i], x[i])
	if ff != -1:
		(l, r) = (ff, ff + len(xx))
		if set(y[:l] or ['1']) == set(y[r:] or y[-1]) == set(['1']):
			print('YES')
			exit(0)
print('NO')


from sys import stdin, stdout
(x, y) = [int(z) for z in stdin.readline().split()]
answer = 'NO'
if x == y:
	answer = 'YES'
x_reduced = x
while x_reduced % 2 == 0:
	x_reduced = x_reduced // 2
y_bin = str(bin(y))[2:]
x_reduced_bin = str(bin(x_reduced))[2:]
if len(x_reduced_bin) <= len(y_bin):
	delta = len(y_bin) - len(x_reduced_bin)
	for i in range(delta + 1):
		candidate = '1' * i + x_reduced_bin + '1' * (delta - i)
		if candidate == y_bin:
			answer = 'YES'
x_reduced_bin = x_reduced_bin[::-1]
if len(x_reduced_bin) <= len(y_bin):
	delta = len(y_bin) - len(x_reduced_bin)
	for i in range(delta + 1):
		candidate = '1' * i + x_reduced_bin + '1' * (delta - i)
		if candidate == y_bin:
			answer = 'YES'
x_reduced_bin = str(bin(x))[2:] + '1'
if len(x_reduced_bin) <= len(y_bin):
	delta = len(y_bin) - len(x_reduced_bin)
	for i in range(delta + 1):
		candidate = '1' * i + x_reduced_bin + '1' * (delta - i)
		if candidate == y_bin:
			answer = 'YES'
x_reduced_bin = x_reduced_bin[::-1]
if len(x_reduced_bin) <= len(y_bin):
	delta = len(y_bin) - len(x_reduced_bin)
	for i in range(delta + 1):
		candidate = '1' * i + x_reduced_bin + '1' * (delta - i)
		if candidate == y_bin:
			answer = 'YES'
stdout.write(answer + '\n')


(a, b) = map(lambda s: bin(int(s))[2:], input().split())
(a0, a1) = (a + '1', a.rstrip('0'))
if a == b or __import__('re').fullmatch(f'1*({a0}|{a1}|{a0[::-1]}|{a1[::-1]})1*', b):
	print('YES')
else:
	print('NO')


L = input().split(' ')
s1 = str(bin(int(L[0])))[2:]
s2 = str(bin(int(L[1])))[2:]
n1 = 0
n2 = 0
for i in range(len(s1)):
	if s1[i] == '0':
		n1 += 1
for i in range(len(s2)):
	if s2[i] == '0':
		n2 += 1
if s1 == s2:
	print('YES')
else:
	if s1[-1] == '0':
		if n1 == n2:
			s1 += '1'
		else:
			while s1[-1] == '0':
				n1 -= 1
				s1 = s1[:-1]
	if n1 != n2:
		print('NO')
	elif s2.find(s1) != -1 or s2.find(s1[::-1]) != -1:
		print('YES')
	else:
		print('NO')


(x, y) = map(int, input().split())
x = str(bin(x))[2:]
y = str(bin(y))[2:]
(x1, x2) = (x.rstrip('0'), x + '1')
if x == y or __import__('re').fullmatch(f'1*({x1}|{x2}|{x1[::-1]}|{x2[::-1]})1*', y):
	print('YES')
else:
	print('NO')


import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq

def input():
	return sys.stdin.readline()[:-1]
sys.setrecursionlimit(1000000)
INF = 10 ** 10
YES = 'YES'
NO = 'NO'

def dfs(s, SY):
	if s == SY:
		return True
	n = int(s)
	if n in ng:
		return False
	if len(s) > 100:
		return False
	ng.add(n)
	for s1 in [str(int(s[::-1])), (s + '1')[::-1]]:
		if s1 in ng:
			continue
		if dfs(s1, SY):
			return True
	return False
ng = set()

def solve(X, Y):
	if X == Y:
		return 'YES'
	SX = bin(X)[2:]
	SY = bin(Y)[2:]
	if dfs(SX, SY):
		return 'YES'
	return 'NO'
(X, Y) = map(int, input().split())
print(solve(X, Y))


def performOperation(x):
	xb = bin(x)[2:]
	a = xb + '0'
	a = a[::-1]
	b = xb + '1'
	b = b[::-1]
	x2 = int(a, 2)
	x3 = int(b, 2)
	return (x2, x3)

def main():
	(x, x2) = readIntArr()
	vi = set()
	vi.add(x)
	st = [x]
	while st:
		x = st.pop()
		for y in performOperation(x):
			if y <= 1e+18 and y not in vi:
				vi.add(y)
				st.append(y)
	if x2 in vi:
		print('YES')
	else:
		print('NO')
	return
import sys
input = sys.stdin.buffer.readline

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()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(i, j):
	print('? {} {}'.format(i, j))
	sys.stdout.flush()
	return int(input())

def answerInteractive(i, j, k):
	print('! {} {} {}'.format(i, j, k))
	sys.stdout.flush()
inf = float('inf')
from math import gcd, floor, ceil
import math
for _abc in range(1):
	main()


def solver():
	(first_num, second_num) = map(int, input().split())
	if first_num == second_num:
		print('YES')
		return 0
	base_2_first_num_rev = ''
	base_2_second_num_rev = ''

	def div_mod2(a):
		return (a // 2, a % 2)
	while first_num > 0:
		(first_num, coef) = div_mod2(first_num)
		base_2_first_num_rev += str(coef)
	while second_num > 0:
		(second_num, coef) = div_mod2(second_num)
		base_2_second_num_rev += str(coef)
	(base_2_first_num, base_2_second_num) = (base_2_first_num_rev[::-1], base_2_second_num_rev[::-1])
	if base_2_second_num[-1] == '0':
		print('NO')
		return 0
	n = len(base_2_first_num)
	n_1 = len(base_2_second_num) - n
	for i in range(n_1 + 1):
		check = base_2_second_num[i:i + n]
		not_until_now = base_2_second_num[i + n:]
		until_now = base_2_second_num[:i]
		if check == base_2_first_num_rev or check == base_2_first_num:
			if not ('0' in until_now or '0' in not_until_now):
				print('YES')
				return 0
	while base_2_first_num[-1] == '0':
		base_2_first_num = base_2_first_num[:-1]
		base_2_first_num_rev = base_2_first_num_rev[1:]
	n = len(base_2_first_num)
	n_1 = len(base_2_second_num) - n
	for i in range(n_1 + 1):
		check = base_2_second_num[i:i + n]
		not_until_now = base_2_second_num[i + n:]
		until_now = base_2_second_num[:i]
		if check == base_2_first_num_rev or check == base_2_first_num:
			if not ('0' in until_now or '0' in not_until_now):
				print('YES')
				return 0
	print('NO')
	return 0
solver()


(x, y) = map(int, input().split())
if x == y:
	print('YES')
	exit(0)
(s1, s2) = (list(bin(x)[2:]), bin(y)[2:])
s3 = bin(x)[2:]
r_s3 = s3[::-1]
while s1[-1] == '0':
	s1.pop()
s1 = ''.join(s1)
r_s1 = s1[::-1]
for i in range(len(s2) - len(s1) + 1):
	if s2[i:i + len(s1)] == s1 and s2[:i].count('0') == 0 and (s2[i + len(s1):].count('0') == 0):
		print('YES')
		exit(0)
	if s2[i:i + len(s1)] == r_s1 and s2[:i].count('0') == 0 and (s2[i + len(s1):].count('0') == 0):
		print('YES')
		exit(0)
if s3 != s1:
	for i in range(len(s2) - len(s3) + 1):
		if s2[i:i + len(s3)] == s3 and s2[:i].count('0') == 0 and (s2[i + len(s3):].count('0') == 0):
			if s2[i + len(s3):].count('1') != 0:
				print('YES')
				exit(0)
		if s2[i:i + len(s3)] == r_s3 and s2[:i].count('0') == 0 and (s2[i + len(s3):].count('0') == 0):
			print('YES')
			exit(0)
print('NO')


(x, y) = map(int, input().split())
s = set()
s.add(x)
a = [x]
for u in a:
	if u > 10 ** 20:
		continue
	k = 2 * u + 0
	b = bin(k)[2:][::-1]
	v = int(b, 2)
	if v not in s:
		s.add(v)
		a.append(v)
	k = 2 * u + 1
	b = bin(k)[2:][::-1]
	v = int(b, 2)
	if v not in s:
		s.add(v)
		a.append(v)
print('YES' if y in s else 'NO')


import math
(x, y) = [bin(int(XXX))[2:] for XXX in input().split(' ')]
if x == y:
	print('YES')
	quit()
A = (x + '1')[::-1]
B = str(int(x[::-1]))
if A in y:
	left = y.find(A)
	right = left + len(A) - 1
	if left != -1:
		if not '0' in y[0:left] and (not '0' in y[right + 1:]):
			print('YES')
			quit()
A = A[::-1]
if A in y:
	left = y.find(A)
	right = left + len(A) - 1
	if left != -1:
		if not '0' in y[0:left] and (not '0' in y[right + 1:]):
			print('YES')
			quit()
if B in y:
	left = y.find(B)
	right = left + len(B) - 1
	if left != -1:
		if not '0' in y[0:left] and (not '0' in y[right + 1:]):
			print('YES')
			quit()
B = B[::-1]
if B in y:
	left = y.find(B)
	right = left + len(B) - 1
	if left != -1:
		if not '0' in y[0:left] and (not '0' in y[right + 1:]):
			print('YES')
			quit()
print('NO')


import sys, os
import math
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
from io import BytesIO, IOBase
from heapq import *
from bisect import *
from collections import *

def check(x, y):
	if x == y:
		return 'YES'
	for p in [x + '1', x.strip('0')]:
		for l in range(len(y) - len(p) + 1):
			r = len(y) - len(p) - l
			if '1' * l + p + '1' * r == y or '1' * l + p[::-1] + '1' * r == y:
				return 'YES'
	return 'NO'

def main():
	(x, y) = MI()
	x = bin(x)[2:]
	y = bin(y)[2:]
	print(check(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')

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

def mi():
	return int(input())

def outP(var):
	sys.stdout.write(str(var) + '\n')
MOD = 10 ** 9 + 7
mod = 998244353
main()


import sys
import math
from itertools import accumulate
from fractions import gcd
from functools import reduce

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

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

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

def trywith(s1, s2):
	n = len(s2) - len(s1)
	for i in range(n + 1):
		for j in range(i + 1):
			new_s1 = ''.join(['1' for _ in range(j)]) + s1 + ''.join(['1' for _ in range(i - j)])
			if new_s1 == s2 or new_s1[::-1] == s2:
				return True
	return False

def trywithspecial(s1, s2):
	if s1 == s2:
		return True
	n = len(s2) - len(s1)
	for i in range(n + 1):
		for j in range(i):
			new_s1 = ''.join(['1' for _ in range(j)]) + s1 + ''.join(['1' for _ in range(i - j)])
			if new_s1 == s2 or new_s1[::-1] == s2:
				return True
	return False

def solve():
	(x, y) = read_ints()
	xb = '{0:b}'.format(x)
	yb = '{0:b}'.format(y)
	if trywithspecial(xb, yb):
		print('YES')
		return
	xb = xb[::-1]
	k = 0
	while k < len(xb) and xb[k] == '0':
		k += 1
	xb_no_leading_zeros = xb[k:]
	if trywith(xb_no_leading_zeros, yb) or trywith(xb_no_leading_zeros[::-1], yb) or trywith('1' + xb, yb) or trywith(('1' + xb)[::-1], yb):
		print('YES')
	else:
		print('NO')
T = 1
for _ in range(T):
	solve()


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

def get():
	return int(input())

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

def S():
	for test in range(int(input())):
		solve()
import math
import itertools as it
import bisect
import time
import collections as ct

def lower_bound(a, x):
	l = -1
	r = len(a)
	while l + 1 != r:
		mid = l + r >> 1
		if a[mid] < x:
			l = mid
		else:
			r = mid
	return r

def upper_bound(a, x):
	l = -1
	r = len(a)
	while l + 1 != r:
		mid = l + r >> 1
		if a[mid] <= x:
			l = mid
		else:
			r = mid
	return r

def get1(x):
	s = x + '1'
	s = s[::-1]
	return s

def get0(x):
	s = x + '0'
	s = s.strip('0')
	return s[::-1]
s = set()

def solve():
	flag = 0
	(x, y) = getint()
	xx = bin(x)[2:]
	yy = bin(y)[2:]
	q = ct.deque()
	q.append(xx)
	s.add(xx)
	while len(q):
		x = q.popleft()
		if len(x) > 100:
			continue
		new_0 = get0(x)
		if new_0 not in s:
			s.add(new_0)
			q.append(new_0)
		new_1 = get1(x)
		if new_1 not in s:
			s.add(new_1)
			q.append(new_1)
	if yy in s:
		print('YES')
	else:
		print('NO')
solve()


(x, y) = [int(i) for i in input().split(' ')]

def solve():
	if x == y:
		return True
	a = bin(x)[2:]
	b = bin(y)[2:]
	if x == 0:
		if b.count('0') == 1 and b[-1] != 0:
			return True
		else:
			return False
	n = len(a)
	for i in range(n - 1, -1, -1):
		if a[i] != '0':
			c = a[:i + 1]
			break
	p = [a, '1' + a[::-1], c, c[::-1]]

	def ck(aa, bb):
		(mm, nn) = (len(aa), len(bb))
		if mm > nn:
			return False
		if mm == nn:
			return aa == bb
		if bb[-1] == '0':
			return False
		for i in range(nn - mm + 1):
			if bb[i] == '0':
				return False
			if bb[i:i + mm] == aa:
				if set(bb[i + mm:]) == set('1') or set(bb[i + mm:]) == set():
					return True
		return False
	for i in p:
		if ck(i, b):
			return True
	return False
if solve():
	print('YES')
else:
	print('NO')


from collections import deque

def gs():
	return input()

def gi():
	return int(input())

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

def gt():
	return map(int, input().split())
(x, y) = gt()
queue = deque([bin(x)[2:]])
visited = set([x])
possible = False
while queue:
	cur = queue.popleft()
	if int(cur, 2) == y:
		possible = True
		break
	if len(cur) > 60:
		continue
	one = cur[:] + '1'
	onebit = int(one[::-1], 2)
	if onebit not in visited:
		queue.append(bin(onebit)[2:])
		visited.add(onebit)
	zero = cur[:] + '0'
	zerobit = int(zero[::-1], 2)
	if zerobit not in visited:
		queue.append(bin(zerobit)[2:])
		visited.add(zerobit)
if possible:
	print('YES')
else:
	print('NO')


import re

def do(x, y):
	match = re.search(f'^1*{x}1*$', y)
	if match:
		return True
	else:
		return False
(x, y) = map(int, input().split())
x1 = bin(x)[2:]
x2 = x1[::-1]
i = 0
while x2[i] == '0':
	i = i + 1
x3 = x2[i:]
x4 = x3[::-1]
if x1[-1] == '0':
	x1 += '1'
y = bin(y)[2:]
if do(x1, y) or do(x2, y) or do(x3, y) or do(x4, y) or (bin(x)[2:] == y):
	print('YES')
else:
	print('NO')


(x, y) = map(int, input().split())
(x_bin, y_bin) = (bin(x)[2:], bin(y)[2:])
if x_bin == y_bin:
	print('YES')
elif y_bin[-1] == '0':
	print('NO')
else:
	x_bin += '1'
	if (y_bin.find(x_bin) != -1 or y_bin.find(x_bin[::-1]) != -1) and y_bin.count('1') - x_bin.count('1') == len(y_bin) - len(x_bin):
		print('YES')
	else:
		x_bin = x_bin[:-1]
		while x_bin[-1] == '0':
			x_bin = x_bin[:-1]
		print('YES') if (y_bin.find(x_bin) != -1 or y_bin.find(x_bin[::-1]) != -1) and y_bin.count('1') - x_bin.count('1') == len(y_bin) - len(x_bin) else print('NO')


import collections

def cal(x):
	tmp = 0
	while x:
		tmp = tmp * 2 + (x & 1)
		x >>= 1
	return tmp

def solve(x, y):
	if x == y:
		return True
	q = collections.deque()
	q.append(x)
	vis = set()
	vis.add(x)
	while q:
		n = q.popleft()
		(n1, n2) = (n << 1, (n << 1) + 1)
		(n3, n4) = (cal(n1), cal(n2))
		n1 = cal(n3)
		n5 = cal(n4)
		for nn in [n1, n2, n3, n4, n5]:
			if nn == y:
				return True
			else:
				if nn > y or nn in vis:
					continue
				vis.add(nn)
				q.append(nn)
	return False
(x, y) = map(int, input().split())
if solve(x, y):
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
from collections import defaultdict
input = stdin.readline
from random import randint
import math
import sys

def oper1(x):
	bin = []
	y = x
	while y > 0:
		bin.append(y % 2)
		y = y >> 1
	new = 0
	for i in range(len(bin)):
		new = (new << 1) + bin[i]
	return new

def oper2(x):
	bin = [1]
	y = x
	while y > 0:
		bin.append(y % 2)
		y = y >> 1
	new = 0
	for i in range(len(bin)):
		new = (new << 1) + bin[i]
	return new
(X, Y) = map(int, input().split())
(x, y) = (X, Y)
answer = False
if x == y:
	answer = True
targety = []
while y > 0:
	targety.append(str(y % 2))
	y = y // 2
targety = ''.join(reversed(targety))

def checkpossible(XX, targety):
	x = XX
	startx = []
	while x > 0:
		startx.append(str(x % 2))
		x = x // 2
	startx.reverse()
	startx = ''.join(startx)
	if len(startx) > len(targety):
		return False
	if startx == targety:
		return True
	for i in range(len(targety)):
		match = True
		for j in range(len(startx)):
			if i + j > len(targety) - 1 or targety[i + j] != startx[j]:
				match = False
				break
		if match == True:
			if (i == 0 or targety[0:i].find('0') == -1) and targety[i + len(startx):].find('0') == -1 and (False == (i + len(startx) == len(targety) and startx[-1] == '0')):
				return True
	return False
answer = answer or checkpossible(X, targety) or checkpossible(oper1(X), targety) or checkpossible(oper2(X), targety)
answer = answer or checkpossible(oper1(oper1(X)), targety) or checkpossible(oper1(oper1(X)), targety) or checkpossible(oper2(oper1(X)), targety)
if answer:
	print('YES')
else:
	print('NO')


def check_candidate(y, candidate):
	if candidate in y:
		a = set(list(y.replace(candidate, '', 1)))
		if len(a) == 1 and '1' in a:
			return True
	return False

def slv(x, y):
	if x == y:
		return 'YES'
	candidates = set()
	candidates.add(x + '1')
	candidates.add(x.rstrip('0'))
	if y in candidates or y[::-1] in candidates:
		return 'YES'
	for candidate in candidates:
		if check_candidate(y, candidate):
			return 'YES'
		if check_candidate(y, candidate[::-1]):
			return 'YES'
	return 'NO'
(x, y) = [int(_) for _ in input().rstrip().split(' ')]
y = bin(y)[2:]
x = bin(x)[2:]
print(slv(x, y))


import itertools
import functools

def op0(x):
	return int(bin(x)[2:][::-1], 2)

def op1(x):
	return int('1' + bin(x)[2:][::-1], 2)

def solve(x, y, x_nums):
	if x == y:
		return True
	if x > 1e+20:
		return False
	if x in x_nums:
		return False
	x_nums.add(x)
	return solve(op0(x), y, x_nums) or solve(op1(x), y, x_nums)

def main():
	(x, y) = map(int, input().split())
	if solve(x, y, set()):
		print('YES')
	else:
		print('NO')
main()


from collections import deque
(x, y) = map(int, input().split())
bin_x = bin(x)[2:]
bin_y = bin(y)[2:]
visited = {}
q = deque([bin_x])
while len(q):
	new = q.popleft()
	if new in visited or len(new.strip('0')) > len(bin_y):
		continue
	elif new == bin_y:
		print('YES')
		quit()
	visited[new] = True
	q.append(new[::-1].strip('0'))
	q.append(('1' + new[::-1]).strip('0'))
print('NO')


def prov(z, x):
	l = len(x)
	m = len(z)
	e = 0
	for i in range(l - m + 1):
		if z == x[i:m + i]:
			e = 1
			x = x[:i] + x[m + i:]
			break
	if e == 1:
		for i in x:
			if i == '0':
				e = -1
				break
	return e
a = []
(x, y) = map(int, input().split())
z = str(bin(x))[2:]
zz = z + '1'
while z[-1] == '0':
	z = z[:-1]
a.append(z)
a.append(zz)
a.append(zz[::-1])
a.append(z[::-1])
v = str(bin(y))[2:]
t = 0
for i in a:
	if prov(i, v) == 1:
		t = 1
		break
if x == y:
	print('YES')
elif t == 1:
	print('YES')
else:
	print('NO')


def contain(a, b):
	if not '0' in b:
		if not '0' in a:
			if len(a) <= len(b):
				return True
			return False
		return False
	if not '0' in a:
		return False
	listA = list(a)
	listB = list(b)
	Aleft = 0
	Aright = 0
	Bleft = 0
	Bright = 0
	while listA[0] == '1':
		listA.remove('1')
		Aleft += 1
	while listA[-1] == '1':
		listA.pop()
		Aright += 1
	while listB[0] == '1':
		listB.remove('1')
		Bleft += 1
	while listB[-1] == '1':
		listB.pop()
		Bright += 1
	reA = listA.copy()
	reA.reverse()
	return listA == listB and Aleft <= Bleft and (Aright <= Bright) or (reA == listB and Aright <= Bleft and (Aleft <= Bright))

def find(x, y):
	a = bin(x)[2:]
	b = bin(y)[2:]
	if a == b:
		return True
	if a[-1] == '1':
		return contain(a, b)
	temp = list(a)
	while temp[-1] == '0':
		temp.pop()
	aa = ''.join(temp)
	aaa = a + '1'
	return contain(aa, b) or contain(aaa, b)
line = input().split()
x = int(line[0])
y = int(line[1])
if find(x, y):
	print('YES')
else:
	print('NO')


(x, y) = [int(i) for i in input().split(' ')]
ans = 'NO'
if x == y:
	print('YES')
	exit(0)
(bin_x, bin_y) = (str(bin(x))[2:], str(bin(y))[2:])
try:
	i1 = bin_y.index(bin_x + '1')
	re = set(bin_y[:i1] + bin_y[i1 + len(bin_x) + 1:])
	if len(re) == 0 or (len(re) == 1 and '1' in re):
		ans = 'YES'
except:
	pass
try:
	i2 = bin_y.index((bin_x + '1')[::-1])
	re = set(bin_y[:i2] + bin_y[i2 + len(bin_x) + 1:])
	if len(re) == 0 or (len(re) == 1 and '1' in re):
		ans = 'YES'
except:
	pass
bin_x = bin_x.strip('0')
try:
	i3 = bin_y.index(bin_x)
	re = set(bin_y[:i3] + bin_y[i3 + len(bin_x):])
	if len(re) == 0 or (len(re) == 1 and '1' in re):
		ans = 'YES'
except:
	pass
try:
	i4 = bin_y.index(bin_x[::-1])
	re = set(bin_y[:i4] + bin_y[i4 + len(bin_x):])
	if len(re) == 0 or (len(re) == 1 and '1' in re):
		ans = 'YES'
except:
	pass
print(ans)


import sys
inpu = sys.stdin.readline
prin = sys.stdout.write
(x, y) = map(int, inpu().split())
if y == x:
	print('YES')
	exit()
x = bin(x)[2:]
y = bin(y)[2:]
ind = 0
for i in range(len(x)):
	if x[i] == '1':
		ind = i
use = x[:ind + 1]
if use in y:
	ind = y.index(use)
	if '0' not in y[:ind] and '0' not in y[ind + len(use):]:
		print('YES')
		exit()
use = use[::-1]
if use in y:
	ind = y.index(use)
	if '0' not in y[:ind] and '0' not in y[ind + len(use):]:
		print('YES')
		exit()
use = x + '1'
if use in y:
	ind = y.index(use)
	if '0' not in y[:ind] and '0' not in y[ind + len(use):]:
		print('YES')
		exit()
use = use[::-1]
if use in y:
	ind = y.index(use)
	if '0' not in y[:ind] and '0' not in y[ind + len(use):]:
		print('YES')
		exit()
print('NO')


import array
import bisect
import heapq
import math
import collections
import sys
import copy
from functools import reduce
import decimal
from io import BytesIO, IOBase
import os
import itertools
import functools
from types import GeneratorType
decimal.getcontext().rounding = decimal.ROUND_HALF_UP
graphDict = collections.defaultdict
queue = collections.deque

def bootstrap(f, stack=[]):

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

class Graphs:

	def __init__(self):
		self.graph = graphDict(set)

	def add_edge(self, u, v):
		self.graph[u].add(v)
		self.graph[v].add(u)

	def dfs_utility(self, nodes, visited_nodes, colors, parity, level):
		global count
		if nodes == 1:
			colors[nodes] = -1
		elif len(self.graph[nodes]) == 1 and parity % 2 == 0:
			if q == 1:
				colors[nodes] = 1
			else:
				colors[nodes] = -1
				count += 1
		elif parity % 2 == 0:
			colors[nodes] = -1
		else:
			colors[nodes] = 1
		visited_nodes.add(nodes)
		for neighbour in self.graph[nodes]:
			new_level = level + 1
			if neighbour not in visited_nodes:
				self.dfs_utility(neighbour, visited_nodes, colors, level - 1, new_level)

	def dfs(self, node):
		Visited = set()
		color = collections.defaultdict()
		self.dfs_utility(node, Visited, color, 0, 0)
		return color

	def bfs(self, node, f_node):
		count = float('inf')
		visited = set()
		level = 0
		if node not in visited:
			queue.append([node, level])
			visited.add(node)
		flag = 0
		while queue:
			parent = queue.popleft()
			if parent[0] == f_node:
				flag = 1
				count = min(count, parent[1])
			level = parent[1] + 1
			for item in self.graph[parent[0]]:
				if item not in visited:
					queue.append([item, level])
					visited.add(item)
		return count if flag else -1
		return False

class Tree:

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

def inorder(node, lis):
	if node:
		inorder(node.left, lis)
		lis.append(node.data)
		inorder(node.right, lis)
	return lis

def leaf_node_sum(root):
	if root is None:
		return 0
	if root.left is None and root.right is None:
		return root.data
	return leaf_node_sum(root.left) + leaf_node_sum(root.right)

def hight(root):
	if root is None:
		return -1
	if root.left is None and root.right is None:
		return 0
	return max(hight(root.left), hight(root.right)) + 1

class UnionFind:
	parents = []
	sizes = []
	count = 0

	def __init__(self, n):
		self.count = n
		self.parents = [i for i in range(n)]
		self.sizes = [1 for i in range(n)]

	def find(self, i):
		if self.parents[i] == i:
			return i
		else:
			self.parents[i] = self.find(self.parents[i])
			return self.parents[i]

	def unite(self, i, j):
		root_i = self.find(i)
		root_j = self.find(j)
		if root_i == root_j:
			return
		elif root_i < root_j:
			self.parents[root_j] = root_i
			self.sizes[root_i] += self.sizes[root_j]
		else:
			self.parents[root_i] = root_j
			self.sizes[root_j] += self.sizes[root_i]

	def same(self, i, j):
		return self.find(i) == self.find(j)

	def size(self, i):
		return self.sizes[self.find(i)]

	def group_count(self):
		return len(set((self.find(i) for i in range(self.count))))

	def answer(self, extra, p, q):
		dic = collections.Counter()
		for q in range(n):
			dic[self.find(q)] = self.size(q)
		hq = list(dic.values())
		heapq._heapify_max(hq)
		ans = -1
		for z in range(extra + 1):
			if hq:
				ans += heapq._heappop_max(hq)
			else:
				break
		return ans

def rounding(n):
	return int(decimal.Decimal(f'{n}').to_integral_value())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def p_sum(array):
	return list(itertools.accumulate(array))

def base_change(nn, bb):
	if nn == 0:
		return [0]
	digits = []
	while nn:
		digits.append(int(nn % bb))
		nn //= bb
	return digits[::-1]

def diophantine(a: int, b: int, c: int):
	(d, x, y) = extended_gcd(a, b)
	r = c // d
	return (r * x, r * y)

@bootstrap
def extended_gcd(a: int, b: int):
	if b == 0:
		(d, x, y) = (a, 1, 0)
	else:
		(d, p, q) = (yield extended_gcd(b, a % b))
		x = q
		y = p - q * (a // b)
	yield (d, 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, **kwargs):
		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 inp():
	return sys.stdin.readline().strip()

def map_inp(v_type):
	return map(v_type, inp().split())

def list_inp(v_type):
	return list(map_inp(v_type))

def solve(source):
	x = bin_y.find(source)
	arr1 = []
	arr2 = []
	for i in range(len(bin_y)):
		if i < x:
			arr1.append(bin_y[i])
		elif i > x + len(source) - 1:
			arr2.append(bin_y[i])
	a = arr1.count('1')
	b = arr2.count('1')
	if a == len(arr1) and b == len(arr2) and (bin_y[-1] != '0'):
		return True
	else:
		return False
(x, y) = map_inp(int)
(bin_x, bin_y) = (bin(x)[2:], bin(y)[2:])
temp = bin_x[::-1].lstrip('0')
temp1 = bin_x.rstrip('0')
temp2 = bin_x[::-1]
if bin_x == bin_y or temp == bin_y or temp1 == bin_y:
	print('YES')
elif bin_x in bin_y:
	if solve(bin_x):
		print('YES')
	elif temp in bin_y:
		if solve(temp):
			print('YES')
		elif temp1 in bin_y:
			if solve(temp1):
				print('YES')
			elif temp2 in bin_y:
				if solve(temp2):
					print('YES')
				else:
					print('NO')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')
elif temp in bin_y:
	if solve(temp):
		print('YES')
	elif temp1 in bin_y:
		if solve(temp1):
			print('YES')
		elif temp2 in bin_y:
			if solve(temp2):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')
elif temp1 in bin_y:
	if solve(temp1):
		print('YES')
	elif temp2 in bin_y:
		if solve(temp2):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
elif temp2 in bin_y:
	if solve(temp2):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import math
(x, y) = map(int, input().split())
bin_x = bin(x)[2:]
bin_y = bin(y)[2:]
lst = [bin_x + '1', bin_x.strip('0')]
flag = False
nxt = False
if bin_x == bin_y:
	print('YES')
	nxt = True
if not nxt:
	for q in lst:
		div = len(bin_y) - len(q) + 1
		for j in range(div):
			if '1' * j + q + '1' * (div - j - 1) == bin_y or '1' * j + q[::-1] + '1' * (div - j - 1) == bin_y:
				print('YES')
				flag = True
				break
		if flag:
			break
	if not flag:
		print('NO')


import sys, os, io
input = sys.stdin.readline
PI = 3.141592653589793
INF = float('inf')
MOD = 1000000007

def bin32(num):
	return '{0:032b}'.format(num)

def add(x, y):
	return (x + y) % MOD

def sub(x, y):
	return (x - y + MOD) % MOD

def mul(x, y):
	return x * y % MOD

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)

def power(x, y):
	res = 1
	x %= MOD
	while y != 0:
		if y & 1:
			res = mul(res, x)
		y >>= 1
		x = mul(x, x)
	return res

def mod_inv(n):
	return power(n, MOD - 2)

def prob(p, q):
	return mul(p, power(q, MOD - 2))

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

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

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

def check(a, b):
	n = len(a)
	m = len(b)
	for i in range(m - n + 1):
		if b[i:i + n] == a:
			flag = 1
			for j in range(i):
				if b[j] == '0':
					flag = 0
			for j in range(i + n, m):
				if b[j] == '0':
					flag = 0
			if flag:
				return 1
	return 0
(x, y) = li()
if x == y:
	print('YES')
	exit(0)
if y % 2 == 0:
	print('NO')
	exit(0)
xx = list(bin(x))[2:]
yy = list(bin(y))[2:]
zz = xx[:]
while zz[-1] == '0':
	zz.pop()
ans = max(check(xx, yy), check(zz, yy), check(list(reversed(xx)), yy), check(list(reversed(zz)), yy))
if ans:
	print('YES')
else:
	print('NO')


from sys import stdin
from collections import deque

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

def read_ints():
	return map(int, stdin.readline().split(' '))

def possible(x, y):
	bx = bin(x)[2:].strip('0')
	by = bin(y)[2:].strip('0')
	return bx in by or bx[::-1] in by

def trans(x):
	return int(bin(x)[2:][::-1].lstrip('0'), base=2)
(x, y) = read_ints()
if not possible(x, y):
	print('NO')
else:
	dq = deque()
	dq.append(x)
	vis = set([x])
	while len(dq) > 0:
		u = dq.popleft()
		if u == y:
			print('YES')
			exit(0)
		for v in range(u * 2, u * 2 + 2):
			vv = trans(v)
			if possible(vv, y) and vv not in vis:
				dq.append(vv)
				vis.add(vv)
	print('NO')


import bisect
import random
mod = 10 ** 9 + 7
eps = 10 ** (-9)

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

def __lcm(a, b):
	return a * b / __gcd(a, b)

def __fact(n):
	return 1 if n == 1 else n * __fact(n - 1)

def __mex(a):
	mex = 0
	a.sort()
	for x in a:
		if x <= mex:
			mex += 1
		else:
			break
	return mex

def __dist(x1, y1, x2, y2):
	return (x1 - x2) ** 2 + (y1 - y2) ** 2

def __getprimes(n):
	isprime = [True for i in range(n + 1)]
	primes = []
	for i in range(2, n + 1):
		if isprime[i]:
			for j in range(i * i, n + 1, i):
				isprime[j] = False
	for i in range(2, n + 1):
		if isprime[i]:
			primes.append(i)
	return primes

def __modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x

def __isprime(n):
	if n < 2:
		return False
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def __cntprimediv(n):
	ret = 0
	x = n
	i = 2
	while i * i <= x:
		while n % i == 0:
			n //= i
			ret += 1
		i += 1
	if n > 1:
		ret += 1
	return ret

def __primefactors(n):
	ret = []
	x = n
	i = 2
	while i * i <= x:
		while n % i == 0:
			ret.append(i)
			n //= i
		i += 1
	if n > 1:
		ret.append(n)
	return ret

def __sumdigit(n):
	ret = 0
	while n > 0:
		ret += n % 10
		n //= 10
	return ret

def __zfunc(s):
	n = len(s)
	z = [0 for i in range(n)]
	l = 0
	r = 0
	for i in range(1, n):
		if r >= i:
			z[i] = min(z[i - l], r - i + 1)
		while z[i] + i < n and s[z[i]] == s[z[i] + i]:
			z[i] += 1
		if i + z[i] - 1 > r:
			l = i
			r = i + z[i] - 1
	return z

def __to(n, x):
	ret = ''
	while n > 0:
		q = n % x
		if q < 10:
			ret += str(q)
		else:
			ret += chr(q - 10 + ord('a'))
		n //= x
	return ret[::-1]

def __delChar(s, c):
	s = list(s)
	while len(s) > 0 and s[0] == c:
		s.pop(0)
	return ''.join(s)

def solve(t_id):
	(n, m) = map(int, input().split())
	tmp1 = n
	tmp2 = m
	ok = False
	if n == m:
		ok = True
	s = __to(n, 2)
	t = __to(m, 2)
	s1 = s + '1'
	s = __delChar(s, '0')[::-1]
	s = __delChar(s, '0')[::-1]
	if t.find(s) != -1:
		l = t.find(s)
		r = t.find(s) + len(s)
		tmp = True
		for i in range(len(t)):
			if i <= l or i >= r:
				if i > 0 and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True
	s = s[::-1]
	if t.find(s) != -1:
		l = t.find(s)
		r = t.find(s) + len(s)
		tmp = True
		for i in range(len(t)):
			if i <= l or i >= r:
				if i > 0 and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True
	s = s1
	s = __delChar(s, '0')[::-1]
	s = __delChar(s, '0')[::-1]
	if t.find(s) != -1:
		l = t.find(s)
		r = t.find(s) + len(s)
		tmp = True
		for i in range(len(t)):
			if i <= l or i >= r:
				if t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True
	s = s[::-1]
	if t.find(s) != -1:
		l = t.find(s)
		r = t.find(s) + len(s)
		tmp = True
		for i in range(len(t)):
			if i <= l or i >= r:
				if i > 0 and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True
	print('YES' if ok else 'NO')
t = 1
for i in range(t):
	solve(t)


(a, b) = list(map(int, input().strip().split()))
a_str = '{0:b}'.format(a)
b_str = '{0:b}'.format(b)
a_str_1 = a_str + '1'
a_str_rev = a_str[::-1].strip('0')
a_str_rev_1 = a_str_1[::-1].strip('0')
a_strs = [a_str.strip('0'), a_str_1, a_str_rev, a_str_rev_1]
ans = a_str == b_str
for string in a_strs:
	pos = b_str.find(string)
	if pos == -1:
		continue
	b = b_str[:pos] + b_str[pos + len(string):]
	if b == '1' * len(b):
		ans = True
		break
print('YES' if ans else 'NO')


import sys
import typing
from typing import Callable, Dict, List, Set, Tuple
sys.setrecursionlimit(10 ** 6)
Vec = List[int]
VecVec = List[Vec]
sinput: Callable[..., str] = sys.stdin.readline
MOD: int = 998244353
INF: float = float('Inf')
IINF: int = sys.maxsize // 2

def check(bx: str, by: str) -> bool:
	s = by.find(bx)
	if s != -1:
		if '0' not in by[:s] and '0' not in by[s + len(bx):]:
			return True
	return False

def main() -> None:
	(x, y) = map(int, sinput().split())
	if x == y:
		print('YES')
		return
	bx = bin(x)[2:]
	by = bin(y)[2:]
	if by[-1] == '0':
		print('NO')
		return
	if check(bx, by) or check(bx[::-1], by):
		print('YES')
		print(1, file=sys.stderr)
		return
	if bx[-1] == '0':
		print(bx, file=sys.stderr)
		last_z = bx.rfind('1')
		bx = bx[:last_z + 1]
		if check(bx, by) or check(bx[::-1], by):
			print(bx, bx[::-1], by, file=sys.stderr)
			print('YES')
			return
	print('NO')
main()


from math import log2
(x, y) = map(lambda p: bin(int(p))[2:], input().split())
(rx, rx2, rx3) = (bin(int(x[::-1], 2))[2:], '1' + x[::-1], bin(int(x, 2) >> int(log2(int(x, 2) & -int(x, 2))))[2:])
if y in [x, rx, rx2, rx3]:
	print('YES')
	exit(0)
(f1, f2, f3, f4) = (y.find(x), y.find(rx), y.find(rx2), y.find(rx3))
if f1 != -1:
	(l, r) = (f1, f1 + len(x))
	if set(y[:l] or ['1']) == set(y[r:] or x[-1]) == set(['1']):
		print('YES')
		exit(0)
if f2 != -1:
	(l, r) = (f2, f2 + len(rx))
	if set(y[:l] or ['1']) == set(y[r:] or y[-1]) == set(['1']):
		print('YES')
		exit(0)
if f3 != -1:
	(l, r) = (f3, f3 + len(rx2))
	if set(y[:l] or ['1']) == set(y[r:] or y[-1]) == set(['1']):
		print('YES')
		exit(0)
if f4 != -1:
	(l, r) = (f4, f4 + len(rx3))
	if set(y[:l] or ['1']) == set(y[r:] or y[-1]) == set(['1']):
		print('YES')
		exit(0)
print('NO')


(a, b) = map(int, input().split())
a = str(bin(a)[2:])
b = str(bin(b)[2:])
if b[-1] == '0' and a != b:
	print('NO')
	exit()
elif a == b:
	print('YES')
	exit()
x1 = ''
flag = False
for el in a[::-1]:
	if el == '1':
		flag = True
		x1 += el
	if el == '0':
		if flag:
			x1 += el
x2 = '1' + a[::-1]
if x1 in b:
	y1 = b[:b.find(x1)] + b[b.find(x1) + len(x1):]
	if y1.count('0') == 0:
		print('YES')
		exit()
x1 = x1[::-1]
if x1 in b:
	y1 = b[:b.find(x1)] + b[b.find(x1) + len(x1):]
	if y1.count('0') == 0:
		print('YES')
		exit()
x1 = x2
if x1 in b:
	y1 = b[:b.find(x1)] + b[b.find(x1) + len(x1):]
	if y1.count('0') == 0:
		print('YES')
		exit()
x1 = x1[::-1]
if x1 in b:
	y1 = b[:b.find(x1)] + b[b.find(x1) + len(x1):]
	if y1.count('0') == 0:
		print('YES')
		exit()
print('NO')


def sol(t, s):
	pos = t.find(s)
	while pos != -1:
		x = t[:pos]
		y = t[pos + len(s):]
		if '0' not in x and '0' not in y:
			return True
		pos = t.find(s, pos + 1)
	return False

def solve():
	[x, y] = [int(a) for a in input().split()]
	if x == y:
		print('YES')
		return
	s = list(bin(x)[2:])
	t = bin(y)[2:]
	s1 = list(bin(x)[2:])
	while s1[-1] == '0':
		s1.pop()
	s2 = None
	if s[-1] == '0':
		s2 = s
		s2.append('1')
	if sol(t, ''.join(s1)):
		print('YES')
		return
	if s2 is not None and sol(t, ''.join(s2)):
		print('YES')
		return
	s3 = [x for x in s1]
	s3.reverse()
	if s2 is not None:
		s4 = [x for x in s2]
	else:
		s4 = None
	if sol(t, ''.join(s3)):
		print('YES')
		return
	if s4 is not None:
		s4.reverse()
	if s4 is not None and sol(t, ''.join(s4)):
		print('YES')
		return
	print('NO')
solve()


from collections import defaultdict
import sys
input = sys.stdin.readline
flush = sys.stdout.flush
get_int = lambda : int(input().rstrip())
get_arr = lambda : [int(w) for w in input().split()]

def pb(x):
	print(bin(x)[2:])

def can(a, b):
	for i in range(len(b) - len(a) + 1):
		if b[i] == '0':
			return False
		if b[i:i + len(a)] == a and b[i + len(a):].count('1') == len(b[i + len(a):]):
			return True
	return False

def gl_can(a, b):
	if a == b or b % 2 == 0:
		return a == b
	pos_a = {2 * a + 1}
	while a % 2 == 0:
		a //= 2
	pos_a.add(a)
	b = bin(b)[2:]
	pos_b = {b, b[::-1]}
	return any((can(bin(a)[2:], b) for a in pos_a for b in pos_b))
(a, b) = get_arr()
print('YES' if gl_can(a, b) else 'NO')


import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq

def input():
	return sys.stdin.readline()[:-1]
sys.setrecursionlimit(1000000)
INF = 10 ** 10
YES = 'YES'
NO = 'NO'

def solve(X, Y):
	if X == Y:
		return 'YES'
	SX = bin(X)[2:]
	SY = bin(Y)[2:]
	seen = set()
	seen.add(SX)
	q = []
	q.append(SX)
	while q:
		s = q.pop()
		for s1 in [str(int(s[::-1])), (s + '1')[::-1]]:
			if s1 in seen or len(s1) > 100:
				continue
			if s1 == SY:
				return 'YES'
			seen.add(s1)
			q.append(s1)
	return 'NO'
(X, Y) = map(int, input().split())
print(solve(X, Y))


import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
from collections import Counter
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 ** 18, 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)

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: 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(10001)]
prime[0] = prime[1] = False

def SieveOfEratosthenes(n=10000):
	p = 2
	c = 0
	while p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1

class DSU:

	def __init__(self, R, C):
		self.par = range(R * C + 1)
		self.rnk = [0] * (R * C + 1)
		self.sz = [1] * (R * C + 1)

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def union(self, x, y):
		(xr, yr) = (self.find(x), self.find(y))
		if xr == yr:
			return
		if self.rnk[xr] < self.rnk[yr]:
			(xr, yr) = (yr, xr)
		if self.rnk[xr] == self.rnk[yr]:
			self.rnk[xr] += 1
		self.par[yr] = xr
		self.sz[xr] += self.sz[yr]

	def size(self, x):
		return self.sz[self.find(x)]

	def top(self):
		return self.size(len(self.sz) - 1) - 1

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2

class LazySegUpdate:

	def __init__(self, N):
		self.N = N
		n = 4 * N
		self.tree = [0] * n
		self.lazy = [0] * n

	def queryHelper(self, index, s, e, l, r):
		if self.lazy[index]:
			update = self.lazy[index]
			self.lazy[index] = 0
			self.tree[index] = max(self.tree[index], update)
			if s != e:
				self.lazy[2 * index] = max(self.lazy[2 * index], update)
				self.lazy[2 * index + 1] = max(self.lazy[2 * index + 1], update)
		if s > e or s > r or e < l:
			return 0
		if s >= l and e <= r:
			return self.tree[index]
		mid = (s + e) // 2
		return max(self.queryHelper(2 * index, s, mid, l, r), self.queryHelper(2 * index + 1, mid + 1, e, l, r))

	def updateHelper(self, index, s, e, l, r, h):
		if self.lazy[index]:
			update = self.lazy[index]
			self.lazy[index] = 0
			self.tree[index] = max(self.tree[index], update)
			if s != e:
				self.lazy[2 * index] = max(self.lazy[2 * index], update)
				self.lazy[2 * index + 1] = max(self.lazy[2 * index + 1], update)
		if s > e or s > r or e < l:
			return
		if s >= l and e <= r:
			self.tree[index] = max(self.tree[index], h)
			if s != e:
				self.lazy[2 * index] = max(self.lazy[2 * index], h)
				self.lazy[2 * index + 1] = max(self.lazy[2 * index + 1], h)
			return
		mid = (s + e) // 2
		self.updateHelper(2 * index, s, mid, l, r, h)
		self.updateHelper(2 * index + 1, mid + 1, e, l, r, h)
		self.tree[index] = max(self.tree[2 * index], self.tree[2 * index + 1])

	def query(self, l, r):
		return self.queryHelper(1, 0, self.N - 1, l, r - 1)

	def update(self, l, r, h):
		self.updateHelper(1, 0, self.N - 1, l, r - 1, h)

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return math.gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = math.gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = math.gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = n
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] >= key:
			res = mid
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = -1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] > key:
			right = mid - 1
		else:
			res = mid
			left = mid + 1
	return res
tt = 1
for _ in range(tt):
	(x, y) = map(int, input().split())
	a = []
	c = x == y
	while x:
		a.append(x % 2)
		x //= 2
	b = []
	while y:
		b.append(y % 2)
		y //= 2
	a = a[::-1]
	b = b[::-1]

	def check(x, y):
		(n, m) = (len(x), len(y))
		ch = 0
		for i in range(m - n + 1):
			if x == y[i:i + n] and 0 not in y[:i] and (0 not in y[i + n:]):
				ch = 1
				break
		return ch
	k = 0
	if a[-1] == 0:
		k = 1
		a.append(1)
	c = c or check(a, b) or check(a[::-1], b)
	if k:
		a.pop()
	while a and a[-1] == 0:
		a.pop()
	c = c or check(a, b) or check(a[::-1], b)
	if c:
		print('YES')
	else:
		print('NO')


def check(s1, s2):
	index = s2.find(s1)
	return False if index == -1 else s2 == '1' * index + s1 + '1' * (len(s2) - index - len(s1))
(x, y) = map(int, input().split())
if y % 2 == 0:
	print('YES' if y == x else 'NO')
elif x % 2:
	print('YES' if check(bin(x)[2:], bin(y)[2:]) or check(bin(x)[2:][::-1], bin(y)[2:]) else 'NO')
else:
	a = check(bin(x)[2:] + '1', bin(y)[2:]) or check((bin(x)[2:] + '1')[::-1], bin(y)[2:])
	xb = bin(x)[2:]
	while xb[-1] == '0':
		xb = xb[:-1]
	b = check(xb, bin(y)[2:]) or check(xb[::-1], bin(y)[2:])
	print('YES' if a or b else 'NO')


import sys, collections, math, bisect, heapq, random, functools, io, os, copy
input = sys.stdin.readline
out = sys.stdout.flush

def rep():
	a = list(map(int, input().split()))
	return a

def sep():
	a = list(input().split())
	return a

class UnionFind:

	def __init__(self, x) -> None:
		self.uf = [-1] * x

	def find(self, x):
		r = x
		while self.uf[x] >= 0:
			x = self.uf[x]
		while r != x:
			(self.uf[r], r) = (x, self.uf[r])
		return x

	def union(self, x, y):
		(ux, uy) = (self.find(x), self.find(y))
		if ux == uy:
			return
		if self.uf[ux] >= self.uf[uy]:
			self.uf[uy] += self.uf[ux]
			self.uf[ux] = uy
		else:
			self.uf[ux] += self.uf[uy]
			self.uf[uy] = ux
		return

	def __print__(self):
		return self.uf

def spfa(x, g, n):
	dis = [float('inf') for i in range(n)]
	dis[x] = 0
	state = [False for i in range(n)]
	state[x] = True
	queue = collections.deque()
	queue.append(x)
	while queue:
		cur = queue.popleft()
		state[cur] = False
		for next_ in g[cur]:
			if dis[next_] > dis[cur] + 1:
				dis[next_] = dis[cur] + 1
				if state[next_] == False:
					state[next_] = True
					queue.append(next_)
	return dis

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def getvalid(s):
	l = 0
	while l < len(s) and s[l] == '0':
		l += 1
	return l

def solve():
	(x, y) = map(int, input().split())
	tar = bin(y)[2:]
	vis = set()
	vis.add(bin(x)[2:])
	m = len(tar)
	queue = collections.deque()
	queue.append(bin(x)[2:])
	flag = 0
	while queue:
		cur = queue.popleft()
		if cur == tar:
			flag = 1
			break
		(next1, next2) = (cur + '0', cur + '1')
		next1 = next1[::-1]
		next2 = next2[::-1]
		(pos1, pos2) = (getvalid(next1), getvalid(next2))
		if pos1 == len(next1):
			next1 = '0'
		else:
			next1 = next1[pos1:]
		if pos2 == len(next2):
			next2 = '1'
		else:
			next2 = next2[pos2:]
		if next1 not in vis and len(next1) <= m:
			vis.add(next1)
			queue.append(next1)
		if next2 not in vis and len(next2) <= m:
			vis.add(next2)
			queue.append(next2)
	if flag:
		print('YES')
	else:
		print('NO')
solve()


import sys as system_break

def Commonfinder(n, m, o, p):
	return f'1*({n}|{m}|{o}|{p})1*'
import math as m
import re as MATCHING_DEVICE_pattern
Input = input()
Input = Input.split()
ablist = []
for i in range(len(Input)):
	ablist.append(int(Input[i]))
a = ablist[0]
b = ablist[1]
Binofa = bin(a)[2:]
Binofb = bin(b)[2:]
Extended_A = Binofa + '1'
Striped_A = Binofa.rstrip('0')
FinalCF = Commonfinder(Extended_A, Striped_A, Extended_A[::-1], Striped_A[::-1])
if len(FinalCF) == 1:
	FinalCF = list(FinalCF)
	FinalCF = FinalCF[0]
	if MATCHING_DEVICE_pattern.fullmatch(FinalCF, Binofb) or Binofa == Binofb:
		print('YES')
else:
	answer = ''
	FinalCF = FinalCF
	if a == b or MATCHING_DEVICE_pattern.fullmatch(FinalCF, Binofb):
		print('YES')
	else:
		print('NO')


def work(a, b, l, r):
	for i in range(max(0, r - len(a)), min(l + 1, len(b) - len(a)) + 1):
		if a == b[i:i + len(a)]:
			print('YES')
			exit(0)
[x, y] = map(int, input().split())
(a, b, c) = ([1], [], [])
while x:
	a.append(x % 2)
	c.append(x % 2)
	x //= 2
while y:
	b.append(y % 2)
	y //= 2
if c == b:
	print('YES')
	exit(0)
c.reverse()
while c[-1] == 0:
	c.pop()
l = -1
r = len(b)
while l + 1 < len(b) and b[l + 1] == 1:
	l += 1
while r - 1 >= 0 and b[r - 1] == 1:
	r -= 1
work(a, b, l, r)
a.reverse()
work(a, b, l, r)
work(c, b, l, r)
c.reverse()
work(c, b, l, r)
print('NO')


import sys
input = sys.stdin.readline
(x, y) = map(int, input().split())
if x == y:
	ans = 'YES'
	print(ans)
	exit()
x = list(bin(x)[2:])
y = list(bin(y)[2:])
x.append('1')
(lx, ly) = (len(x), len(y))
ans = 'NO'
for _ in range(2):
	for i in range(max(0, ly - lx + 1)):
		ok = 1
		for j in range(lx):
			if not x[j] == y[i + j]:
				ok = 0
				break
		if not ok:
			continue
		for j in range(i):
			if y[j] == '0':
				ok = 0
		for j in range(i + lx, ly):
			if y[j] == '0':
				ok = 0
		if ok:
			ans = 'YES'
	x.reverse()
x.pop()
while x[-1] == '0':
	x.pop()
lx = len(x)
for _ in range(2):
	for i in range(max(0, ly - lx + 1)):
		ok = 1
		for j in range(lx):
			if not x[j] == y[i + j]:
				ok = 0
				break
		if not ok:
			continue
		for j in range(i):
			if y[j] == '0':
				ok = 0
		for j in range(i + lx, ly):
			if y[j] == '0':
				ok = 0
		if ok:
			ans = 'YES'
	x.reverse()
print(ans)


from collections import deque
(x, y) = map(int, input().split())
x = bin(x)
x = x[2:]
y = bin(y)
y = y[2:]
used = set()
queue = deque()
queue.append(x)
alarm = False
while len(queue) > 0:
	temp = queue.popleft()
	used.add(temp)
	if temp == y:
		alarm = True
		break
	n1 = str(int(temp[::-1]))
	n2 = temp + '1'
	n2 = str(int(n2))
	if n1 not in used and len(n1) <= len(y):
		queue.append(n1)
	if n2 not in used and len(n2) <= len(y):
		queue.append(n2)
if alarm:
	print('YES')
else:
	print('NO')


def debin(s):
	ret = 0
	mn = 1
	for i in range(len(s) - 1, -1, -1):
		ret += int(s[i]) * mn
		mn *= 2
	return ret
st = set()

def ch(x, y, deep):
	if x in st:
		return 0
	st.add(x)
	if x == y:
		return 1
	if deep == 150:
		return 0
	s = bin(x)[2:]
	if ch(debin(s[::-1]), y, deep + 1) or ch(debin('1' + s[::-1]), y, deep + 1):
		return 1
	return 0
(x, y) = map(int, input().split())
if ch(x, y, 0):
	print('YES')
else:
	print('NO')


import sys
from bisect import bisect_left as lb
from bisect import bisect_right as rb
from collections import deque
from queue import PriorityQueue as pq
from math import gcd
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
lii = lambda : list(map(int, list(ip())))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]
mod = 10 ** 9 + 7
mod1 = 998244353
for _ in range(1):
	(x, y) = il()
	a = bin(x)[2:] + '1'
	b = bin(y)[2:]
	t = len(a)
	fl = 0
	if x == y:
		print('YES')
		continue
	a1 = a[:len(a) - 1]
	for mn in range(2):
		t = len(a)
		for i in range(len(b)):
			if i + t - 1 >= len(b):
				break
			temp = b[i:i + t]
			if temp == a:
				t1 = b[:i]
				t2 = b[i + t:]
				if t1.count('0') or t2.count('0'):
					pass
				else:
					fl = 1
					break
		a = a[::-1]
		for i in range(len(b)):
			if i + t - 1 >= len(b):
				break
			temp = b[i:i + t]
			if temp == a:
				t1 = b[:i]
				t2 = b[i + t:]
				if t1.count('0') or t2.count('0'):
					pass
				else:
					fl = 1
					break
		ind = -1
		for i in range(len(a1) - 1, -1, -1):
			if a1[i] == '1':
				ind = i
				break
		a = a1[:ind + 1]
	if fl:
		print('YES')
	else:
		print('NO')


(x, y) = map(int, input().split())

def check(x, y):
	(b1, b2) = (bin(x)[2:], bin(y)[2:])
	n = len(b2)
	if y == x:
		return True
	c1 = (b1 + '1')[::-1]
	c2 = b1[::-1].lstrip('0')
	c3 = c1[::-1]
	c4 = c2[::-1]
	for cand in [c1, c2, c3, c4]:
		m = len(cand)
		if m > n:
			continue
		for i in range(n - m + 1):
			if b2[i:i + m] == cand and b2[:i].count('0') == 0 and (b2[i + m:].count('0') == 0):
				return True
	return False
ans = check(x, y)
if ans:
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline

def removeLeadingZeors(x):
	index = len(x)
	for i in range(len(x)):
		if x[i] == '1':
			index = i
			break
	return x[index:]

def reverse(x):
	return x[::-1]

def sumString(x):
	ans = 0
	for i in x:
		ans += int(i)
	return ans

def solve(x, y):
	if x == y:
		return True
	x = removeLeadingZeors(bin(x)[2:])
	y = bin(y)[2:]
	test = set()
	temp = removeLeadingZeors(reverse(x))
	test.add(temp)
	test.add(reverse(temp))
	temp = reverse(x + '1')
	test.add(temp)
	test.add(reverse(temp))
	lengthY = len(y)
	for i in test:
		temp = y.find(i)
		if temp != -1:
			length = len(i)
			if lengthY - length == sumString(y[:temp]) + sumString(y[temp + length:]):
				return True
	return False
(x, y) = map(int, input().split())
if solve(x, y):
	print('YES')
else:
	print('NO')


def reverse(string):
	string = string[::-1]
	return string

def b(n):
	return bin(n).replace('0b', '')

def z(a):
	zeroes = 0
	for i in a:
		if i == '0':
			zeroes += 1
	return zeroes
(x, y) = map(int, input().split())
(x, y) = (b(x), b(y))
if len(x) == len(y) and x in y:
	print('YES')
elif x in y and z(x) == z(y) and ((x[-1] == '0' and y[-1] == '0') == 0):
	print('YES')
else:
	(x1, x2, x3, cnt) = (reverse(x), reverse(x + '1'), '', 0)
	for i in x1:
		if i == '0':
			cnt += 1
		else:
			break
	x1 = x1[cnt:]
	x3 = reverse(x1)
	if len(x1) == len(y) and x1 in y:
		print('YES')
	elif len(x2) == len(y) and x2 in y:
		print('YES')
	elif len(x3) == len(y) and x3 in y:
		print('YES')
	elif x3 in y and z(x3) == z(y) and ((x3[-1] == '0' and y[-1] == '0') == 0):
		print('YES')
	elif x1 in y and z(x1) == z(y) and ((x1[-1] == '0' and y[-1] == '0') == 0):
		print('YES')
	elif x2 in y and z(x2) == z(y) and ((x2[-1] == '0' and y[-1] == '0') == 0):
		print('YES')
	else:
		print('NO')


def check(s: str, t: str):
	index = s.find(t)
	return False if index == -1 else s == '1' * index + t + '1' * (len(s) - index - len(t))

def CF_760(x, y):
	if x == y:
		return True
	if y % 2 == 0:
		return False
	binX = bin(x)[2:]
	binY = bin(y)[2:]
	if x % 2:
		return check(binY, binX) or check(binY, binX[::-1])
	binXbina0 = binX[:binX.rfind('1') + 1]
	return check(binY, binX) or check(binY, binX[::-1]) or check(binY, binXbina0) or check(binY, binXbina0[::-1])
print('YES' if CF_760(*map(int, input().split())) else 'NO')


(a, b) = map(int, input().split())
st = bin(a)[2:]
ed = bin(b)[2:]
if st == ed:
	print('YES')
	exit(0)
s1 = st + '1'
s2 = st.strip('0')
for s in [s1, s2, s1[::-1], s2[::-1]]:
	for l in range(len(ed)):
		r = len(ed) - len(s) - l
		if r < 0:
			continue
		if '1' * l + s + '1' * r == ed:
			print('YES')
			exit(0)
print('NO')
exit(0)


(x, y) = map(int, input().split())
num1 = bin(x)[2:]
num2 = bin(y)[2:]
if num2 == num1:
	print('YES')
else:
	ans = ''
	for num in (num1 + '1', str(int(num1[::-1]))[::-1]):
		for i in range(len(num2) - len(num) + 1):
			j = len(num2) - len(num) - i
			if '1' * i + num + '1' * j == num2 or '1' * i + num[::-1] + '1' * j == num2:
				ans = 'YES'
	if ans:
		print(ans)
	else:
		print('NO')


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

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

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
sys.setrecursionlimit(4 * 10 ** 5)
(a, b) = li()
d = {}

def give(num):
	global a, d
	if num in d:
		return
	d[num] = 1
	if num == a:
		print('YES')
		exit()
	if num == 0:
		return
	binary = bin(num)[2:]
	if binary[-1] == '0':
		return
	if len(binary) > 1:
		give(int(binary[::-1][:-1], 2))
	num = int(binary[::-1], 2)
	while num <= 10 ** 18:
		if num == a:
			print('YES')
			exit()
		num = num << 1
	if a == num:
		print('YES')
		exit()
	give(int(binary[::-1], 2))
give(b)
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 isPossible(base, target):
	num_zero_base = base.count('0')
	num_zero_target = target.count('0')
	num_one_base = base.count('1')
	num_one_target = target.count('1')
	if num_one_target < num_one_base or num_zero_target != num_zero_base:
		return False
	return target.find(base) != -1 or target.find(base[::-1]) != -1

def solve():
	(x, y) = map(int, input().split())
	if x == y:
		return 'YES'
	(bx, by) = (bin(x)[2:], bin(y)[2:])
	bx3 = bx.rstrip('0')[::-1]
	bx4 = '1' + bx[::-1]
	return 'YES' if isPossible(bx3, by) or isPossible(bx4, by) else 'NO'
ans = solve()
print(ans)


def check(a, b):
	if a not in b:
		return False
	left = b[:b.find(a)]
	right = b[b.find(a) + len(a):]
	if '0' in left or '0' in right:
		return False
	return True
(x, y) = map(int, input().split())
a = bin(x)[2:]
b = bin(y)[2:]
if a == b:
	print('YES')
	exit()
if check(a + '1', b) or check(a.strip('0'), b):
	print('YES')
elif check((a + '1')[::-1], b) or check(a.strip('0')[::-1], b):
	print('YES')
else:
	print('NO')


import sys as system_break

def Commonfinder(n, m):
	if type(n) != set:
		n = {n}
	if type(m) != set:
		m = {m}
	Common_in_both = n | m
	return Common_in_both
import math as m
import re as MATCHING_DEVICE
Input = input()
Input = Input.split()
ablist = []
for i in range(len(Input)):
	ablist.append(int(Input[i]))
a = ablist[0]
b = ablist[1]
Binofa = bin(a)[2:]
Binofb = bin(b)[2:]
Extended_A = Binofa + '1'
Striped_A = Binofa.rstrip('0')
FirstCF = Commonfinder(Extended_A, Striped_A)
SecondCF = Commonfinder(FirstCF, Extended_A[::-1])
FinalCF = Commonfinder(SecondCF, Striped_A[::-1])
Formated_Str = f'1*({Extended_A}|{Striped_A}|{Extended_A[::-1]}|{Striped_A[::-1]})1*'
if len(FinalCF) == 1:
	FinalCF = list(FinalCF)
	FinalCF = FinalCF[0]
	if MATCHING_DEVICE.fullmatch(FinalCF, Binofb) or Binofa == Binofb:
		print('YES')
else:
	answer = ''
	if a == b or MATCHING_DEVICE.fullmatch(Formated_Str, Binofb):
		print('YES')
	else:
		print('NO')


(a, b) = map(int, input().split())
sus = bin(int(bin(a)[2:][::-1], 2))[2:]
sussy = (bin(a)[2:] + '1')[::-1]
bb = bin(b)[2:]
realsus = sus[::-1]
realsussy = sussy[::-1]
amogus = bin(b)[2:]
great = True
pos = -1
leng = 0
for i in [sus, sussy, realsus, realsussy]:
	lmao = False
	pos = amogus.find(i)
	leng = len(i)
	if pos == -1:
		lmao = True
	if pos != -1:
		c = bb[0:pos] + bb[pos + leng:]
		for i in range(len(c)):
			if c[i] != '1':
				lmao = True
	if lmao == False:
		great = False
print('YES' if not great or a == b else 'NO')


import bisect
import collections
import itertools
import math
import sys
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()

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

def lli(rows):
	return [li() for _ in range(rows)]

def si():
	return input()

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

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

def drank(d, processing, da, rank):
	tmp = 10 ** 9
	if len(d[da]) == 1:
		return 1
	for di in d[da]:
		if processing[di - 1] == 0:
			processing[di - 1] = 1
			tmp = min(tmp, drank(d, processing, di, rank))
			processing[di - 1] = 0
	rank[da - 1] = tmp + 1
	return tmp + 1

def binary_search(n, a):
	l = len(a)
	low = 0
	high = l - 1
	while high >= low:
		mid = (high + low) // 2
		if a[mid] == n:
			return mid
		elif a[mid] > n:
			high = mid - 1
		else:
			low = mid + 1
	return -1
is_prime = [True] * (10 ** 6 + 1)

def primeseive(n):
	is_prime[0] = is_prime[1] = False
	i = 2
	while i * i <= n:
		if is_prime[i] == True:
			for j in range(i * i, n + 1, i):
				is_prime[j] = False
		i += 1

def solve():
	(a, b) = li()
	if a == b:
		return 'YES'
	bina = bin(a).lstrip('0b')
	binb = bin(b).lstrip('0b')
	la = len(bina)
	lb = len(binb)
	nza = bina.count('0')
	nzb = binb.count('0')
	if nzb > nza or la - nza > lb - nzb:
		return 'NO'
	if nza == 0:
		return 'YES'
	if binb[-1] == '0':
		return 'NO'
	if nzb == 0:
		if int(bina[-nza:], 2) != 0:
			return 'NO'
		return 'YES'
	for i in range(lb):
		if binb[i] == '0':
			fz = i
			break
	lz = fz
	for j in range(fz + 1, lb):
		if binb[j] == '0':
			lz = j
	same = binb[fz:lz + 1]
	rsame = same[::-1]
	nfo = fz
	nlo = lb - lz - 1
	y = bina.find(same)
	if y == -1:
		x = bina.find(rsame)
		if x == -1:
			return 'NO'
		else:
			if '0' in bina[:x]:
				return 'NO'
			right = bina[x + (lz - fz + 1):]
			if right == '':
				return 'YES'
			right = right.rstrip('0')
			if '0' in right:
				return 'NO'
			if nlo >= y and nfo >= len(right):
				return 'YES'
			return 'NO'
	else:
		if '0' in bina[:y]:
			return 'NO'
		right = bina[y + (lz - fz + 1):]
		if right == '':
			return 'YES'
		right = right.rstrip('0')
		if '0' in right or right == '':
			return 'NO'
		if nfo >= y and nlo >= len(right):
			return 'YES'
		else:
			x = bina.find(rsame)
			if x == -1:
				return 'NO'
			else:
				if '0' in bina[:x]:
					return 'NO'
				right = bina[x + (lz - fz + 1):]
				if right == '':
					return 'YES'
				right = right.rstrip('0')
				if '0' in right:
					return 'NO'
				if nlo >= y and nfo >= len(right):
					return 'YES'
				return 'NO'

def main():
	print(solve())
main()


import sys
v = set()

def bfs(n):
	if n in v:
		return
	v.add(n)
	if len(n) == len(bb):
		if n == bb:
			print('YES')
			sys.exit(0)
		elif n[0] == '1' and n[-1] == '1':
			bfs(n[::-1])
			return
	elif len(n) > len(bb):
		if n[0] == '1' and n[-1] == '1':
			return
	(p1, p2) = (n + '1', n + '0')
	bfs(p1[::-1])
	bfs(p2[::-1].lstrip('0'))
(a, b) = map(int, input().split())
if a == b:
	print('YES')
else:
	ba = bin(a)[2:]
	bb = bin(b)[2:]
	bfs(ba)
	print('NO')


(a, b) = [int(i) for i in input().split(' ')]
a = bin(a)[2:]
b = bin(b)[2:]
good = lambda a, b: b.replace(a, '', 1) == (len(b) - len(a)) * '1'
check = a == b
check = check or good(a + '1', b)
check = check or good((a + '1')[::-1], b)
while a[-1] == '0':
	a = a[:-1]
check = check or good(a, b)
check = check or good(a[::-1], b)
if check:
	print('YES')
else:
	print('NO')


def check(a, b):
	if a[-1] == '0':
		return False
	rev = a[::-1]
	for i in range(len(b) - len(a) + 1):
		if rev == b[i:i + len(a)] or a == b[i:i + len(a)]:
			(j, k, valid) = (i, i + len(a), True)
			while j >= 0:
				if b[j] == '0':
					valid = False
					break
				j -= 1
			while k < len(b):
				if b[k] == '0':
					valid = False
					break
				k += 1
			if valid:
				return True
	return False
(a, b) = map(int, input().split())
(a, b) = (bin(a)[2:], bin(b)[2:])
if a == b or a + '1' == b or check(a, b) or check(a + '1', b) or check(a.strip('0'), b):
	print('YES')
else:
	print('NO')


(x, y) = [str(bin(int(i)))[2:] for i in input().split()]
if x == y:
	print('YES')
elif y[-1] == '0':
	print('NO')
else:
	x += '1'
	if (y.find(x) != -1 or y.find(x[::-1]) != -1) and y.count('1') - x.count('1') == len(y) - len(x):
		print('YES')
	else:
		x = x[:-1]
		while x[-1] == '0':
			x = x[:-1]
		print('YES') if (y.find(x) != -1 or y.find(x[::-1]) != -1) and y.count('1') - x.count('1') == len(y) - len(x) else print('NO')


import re
(first, second) = map(int, input().split())
first_str = '{0:b}'.format(first)
second_str = '{0:b}'.format(second)
rev_first_str = first_str[::-1]

def trim_zeroes(str):
	return str.lstrip('0')

def trim_both_zeroes(str):
	return str.strip('0')
print('YES' if first_str == second_str or re.fullmatch(f'1*({first_str}1|1{rev_first_str}|{trim_zeroes(rev_first_str)}|{trim_both_zeroes(first_str)})1*', f'{second_str}') else 'NO')


from collections import deque

def main(t):
	(x, y) = map(int, input().split())
	(sx, sy) = (bin(x)[2:], bin(y)[2:])
	dic = {}
	queue = deque()
	queue.append(sx)
	dic[sx] = 1
	i = len(sx) - 1
	while i >= 0 and sx[i] == '0':
		i -= 1
	queue.append(sx[:i + 1])
	dic[sx[:i + 1]] = 1
	while queue:
		curr = queue.popleft()
		nextcurr1 = curr[::-1]
		i = 0
		while nextcurr1[i] == '0':
			i += 1
		nextcurr1 = nextcurr1[i:]
		if nextcurr1 not in dic:
			dic[nextcurr1] = 1
			queue.append(nextcurr1)
		nextcurr2 = (curr + '1')[::-1]
		if nextcurr2 not in dic:
			dic[nextcurr2] = 1
			if len(nextcurr2) <= len(sy):
				queue.append(nextcurr2)
	if sy in dic:
		print('YES')
	else:
		print('NO')
T = 1
t = 1
while t <= T:
	main(t)
	t += 1


(x, y) = [int(x) for x in input().split()]
if x == y:
	print('YES')
	exit()
(a, b) = (bin(x), bin(y))
a = a.replace('0b', '')
b = b.replace('0b', '')
if b[-1] == '0':
	print('NO')
	exit()
if a in b and a.count('0') == b.count('0'):
	print('YES')
	exit()
b = b[::-1]
if a in b and a.count('0') == b.count('0'):
	print('YES')
	exit()
while a[-1] == '0':
	a = a[:len(a) - 1]
if a in b and a.count('0') == b.count('0'):
	print('YES')
	exit()
b = b[::-1]
if a in b and a.count('0') == b.count('0'):
	print('YES')
else:
	print('NO')


def f(s, y):
	if s in y:
		i = y.index(s)
		for j in range(0, i):
			if y[j] != '1':
				return False
		for j in range(i + len(s), len(y)):
			if y[j] != '1':
				return False
		return True
	return False
(x, y) = map(int, input().split())
x = bin(x)[2:]
y = bin(y)[2:]
i = 0
j = x.rfind('1')
s = x[i:j + 1]
s1 = s[::-1]
s3 = x + '1'
s4 = s3[::-1]
if x == y or f(s, y) or f(s1, y) or f(s3, y) or f(s4, y):
	print('YES')
else:
	print('NO')


from functools import lru_cache
from heapq import heappush, heappop, heappushpop
from itertools import permutations
from operator import itemgetter, le
from collections import deque
from collections import Counter
from itertools import accumulate
from collections import defaultdict
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
inf = float('inf')

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

def LI():
	return list(map(int, sys.stdin.readline().split()))
(x, y) = LI()
if x == y:
	print('YES')
	quit()
elif y % 2 == 0:
	print('NO')
	quit()
s = ['0'] * x.bit_length()
t = ['0'] * y.bit_length()
f = -1
l = -1
for i in range(x.bit_length()):
	if x >> i & 1:
		s[i] = '1'
		if f == -1:
			f = i
			l = i
		else:
			l = i
s2 = '1' + ''.join(s)
s = ''.join(s[f:l + 1])
sr = s[::-1]
for i in range(y.bit_length()):
	if y >> i & 1:
		t[i] = '1'
t = ''.join(t)
for i in range(len(t) - len(s) + 1):
	if t[i:i + len(s)] == s or t[i:i + len(s)] == s[::-1]:
		if t[:i] == '1' * i and t[i + len(s):] == '1' * (len(t) - len(s) - i):
			print('YES')
			break
else:
	for i in range(len(t) - len(s2) + 1):
		if t[i:i + len(s2)] == s2 or t[i:i + len(s2)] == s2[::-1]:
			if t[:i] == '1' * i and t[i + len(s2):] == '1' * (len(t) - len(s2) - i):
				print('YES')
				break
	else:
		print('NO')


(a, b) = map(int, input().split())
x = bin(a)[2:]
y = bin(b)[2:]

def add0(s):
	while s[-1] == '0':
		s = s[0:len(s) - 1]
	return s[::-1]

def add1(s):
	s += '1'
	return s[::-1]
v = []
check = []
v.append(x)
check.append(x)
ans = False
while len(v) > 0:
	t = v[0]
	del v[0]
	if t == y:
		ans = True
		break
	else:
		q = add0(t)
		if len(q) < 65 and q not in check:
			v.append(q)
			check.append(q)
		q = add1(t)
		if len(q) < 65 and q not in check:
			v.append(q)
			check.append(q)
if ans:
	print('YES')
else:
	print('NO')


from collections import deque, defaultdict, Counter, OrderedDict
import math, os, sys, heapq, bisect, random
from itertools import *
from io import BytesIO, IOBase

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 fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())
M = 1000000007

def main():
	how_much_noob_I_am = 1
	for _ in range(how_much_noob_I_am):
		(x, y) = sep()
		q = deque()
		q.append(x)
		visited = set()
		ans = 0
		while q:
			s = q.popleft()
			ans += 1
			if s == y:
				print('YES')
				exit()
			p = bin(s).replace('0b', '') + '0'
			p = p[::-1]
			if p not in visited:
				q.append(int(p, 2))
				visited.add(p)
			p = bin(s).replace('0b', '') + '1'
			p = p[::-1]
			if p not in visited:
				q.append(int(p, 2))
				visited.add(p)
			if ans == 10 ** 4:
				break
		print('NO')
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 heapq
import sys
import math
from collections import deque
from bisect import bisect_left, bisect_right
I = sys.stdin.readline
II = lambda : int(I())
IN = lambda x: map(int, x.split())
FN = lambda x: map(float, x.split())
L = lambda x: list(IN(x))
M = 1000000007
P = print
T = True
F = False

def cal(x, y):
	while x & 1 == 1 and y & 1 == 1:
		x = x >> 1
		y = y >> 1
	if x & 1 == 1:
		return False
	while y & 1 == 1:
		y = y >> 1
	while x > 0 and y > 0 and (x & 1 == y & 1):
		x = x >> 1
		y = y >> 1
	if x > 0 or (y > 0 and y & y + 1 != 0):
		return False
	return True

def rev(x):
	return int(bin(x)[:1:-1], 2)
for _ in range(1):
	(x, y) = IN(I())
	ye = 'YES'
	n = 'NO'
	if x == y:
		print(ye)
		break
	if y & 1 == 0:
		print(n)
		break
	t = x
	while t & 1 == 0:
		t = t >> 1
	if t == x:
		res = cal(t, y) or cal(rev(t), y)
	else:
		x = (x << 1) + 1
		res = cal(t, y) or cal(x, y) or cal(rev(t), y) or cal(rev(x), y)
	if res:
		print(ye)
	else:
		print(n)


import io, os

def main(t):
	(x, y) = [int(i) for i in input().split()]
	if x == y:
		print('YES')
		return
	if y % 2 == 0:
		print('NO')
		return
	x = bin(x)[2:]
	xx = x
	y = bin(y)[2:]
	while x[-1] == '0':
		x = x[:-1]
	x = x[::-1]
	now = 0
	while len(y) - now >= len(xx):
		if xx == y[now:now + len(xx)]:
			if not '0' in y[now + len(xx):]:
				print('YES')
				return
		if xx[::-1] == y[now:now + len(xx)]:
			if not '0' in y[now + len(xx):]:
				print('YES')
				return
		if y[now] == '0':
			break
		now += 1
	now = 0
	while len(y) - now >= len(x):
		if x == y[now:now + len(x)]:
			if not '0' in y[now + len(x):]:
				print('YES')
				return
		if x[::-1] == y[now:now + len(x)]:
			if not '0' in y[now + len(x):]:
				print('YES')
				return
		if y[now] == '0':
			break
		now += 1
	print('NO')
T = 1
t = 1
while t <= T:
	main(t)
	t += 1


def solve(current, target):
	queue = [current]
	visited = set()
	while len(queue):
		currentNode = queue.pop(0)
		currentIdx = 0
		while currentNode[currentIdx] == '0':
			currentIdx += 1
		currentNode = currentNode[currentIdx:]
		if currentNode in visited:
			continue
		visited.add(currentNode)
		if currentNode == target:
			return 'YES'
		(newStringOne, newStringTwo) = (currentNode, currentNode + '1')
		if len(currentNode) <= len(target):
			queue.append(newStringTwo[::-1])
		queue.append(newStringOne[::-1])
	return 'NO'
(x, y) = map(int, input().split())
result = solve('{0:b}'.format(x), '{0:b}'.format(y))
print(result)


import io, os
import sys
from sys import stdin
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, namedtuple
from heapq import heappush, heappop
from math import gcd, ceil, floor, factorial, sqrt
from itertools import combinations, permutations
input = sys.stdin.buffer.readline

def get(p):
	n = len(p)
	i = 0
	while i < n and p[i] == '0':
		i += 1
	return p[i:]

def work(stt, end):
	(n, m) = (len(stt), len(end))
	if stt == end:
		return True
	q = deque()
	q.append(stt)
	seen = set()
	while q:
		t = q.popleft()
		if t not in seen:
			seen.add(t)
			p = t[::-1]
			p = get(p)
			if p == end:
				return True
			if len(p) <= m:
				q.append(p)
			p = t + '1'
			p = p[::-1]
			p = get(p)
			if len(p) <= m:
				q.append(p)
			if p == end:
				return True
	return False

def main():
	test = 1
	for idt in range(test):
		(a, b) = map(int, input().split())
		stt = bin(a)[2:]
		end = bin(b)[2:]
		if work(stt, end):
			print('YES')
		else:
			print('NO')
	return
main()


import collections

def solve():

	def add_one(val):
		bs = bin(val)[2:] + '1'
		bs = bs[::-1]
		return int(bs, 2)

	def add_zero(val):
		bs = bin(val)[2:] + '0'
		bs = bs[::-1]
		return int(bs, 2)
	(a, b) = list(map(int, input().split()))
	deq = collections.deque()
	deq.append(a)
	ss = set()
	ss.add(a)
	while deq:
		a = deq.popleft()
		if a == b:
			print('YES')
			return
		if a & 1:
			na = add_zero(a)
			if na <= b and na not in ss:
				ss.add(na)
				deq.append(na)
			na = add_one(a)
			if (na <= b or add_zero(na) <= b) and na not in ss:
				ss.add(na)
				deq.append(na)
		else:
			na = add_zero(a)
			if na not in ss:
				ss.add(na)
				deq.append(na)
			na = add_one(a)
			if (na <= b or add_zero(na) <= b) and na not in ss:
				ss.add(na)
				deq.append(na)
	print('NO')
solve()


(x, y) = map(int, input().split())
used = set()
s = [x]
f = False
for _ in range(10000):
	if len(s) == 0:
		break
	a = s[0]
	del s[0]
	if a == y:
		f = True
		break
	b = bin(a).lstrip('0b')
	y1 = int('0b' + (b + '0')[::-1], 2)
	y2 = int('0b' + (b + '1')[::-1], 2)
	if y1 == y or y2 == y:
		f = True
		break
	if y1 not in used:
		used.add(y1)
		s.append(y1)
	if y2 not in used:
		used.add(y2)
		s.append(y2)
if f:
	print('YES')
else:
	print('NO')


def check(first, second):
	idx = second.find(first)
	if idx == -1:
		return False
	return '0' not in second[:idx] and '0' not in second[idx + len(first):]

def solve(x, y):
	if x == y:
		return True
	x_bin = bin(x)[2:]
	y_bin = bin(y)[2:]
	first = '1' + x_bin[::-1]
	second = x_bin[:x_bin.rfind('1') + 1]
	return any((check(s, y_bin) for s in [first, first[::-1], second, second[::-1]]))
(x, y) = map(int, input().split())
print('YES' if solve(x, y) else 'NO')


def check(s, t):
	idx = t.find(s)
	if idx != -1:
		lft = t[:idx]
		rght = t[idx + len(s):]
		if lft.count('0') + rght.count('0') == 0:
			return True
		else:
			return False
	else:
		return False
(n, m) = map(int, input().split())
sn = bin(n)[2:]
sm = bin(m)[2:]
if sn == sm:
	print('YES')
	exit()
if sn[-1] != '0':
	sn_d = sn
	if check(sn_d, sm):
		print('YES')
		exit()
	sn_d = sn[::-1]
	if check(sn_d, sm):
		print('YES')
		exit()
sn_d = sn + '1'
if check(sn_d, sm):
	print('YES')
	exit()
sn_d = '1' + sn[::-1]
if check(sn_d, sm):
	print('YES')
	exit()
sn_d = sn.rstrip('0')
if check(sn_d, sm):
	print('YES')
	exit()
sn_d = sn.rstrip('0')[::-1]
if check(sn_d, sm):
	print('YES')
	exit()
print('NO')


import sys
import bisect
from bisect import bisect_left as lb
from bisect import bisect_right as rb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
sflo = lambda : list(map(float, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
sys.setrecursionlimit(3 * 10 ** 5)
mod = 10 ** 9 + 7
mod1 = 998244353
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs2(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)
ans = 0
a = []
(n, k) = (0, 0)
b = []
vis = []
tot = 0
time = []
time1 = []
adj = []
mx = -1
eps = 1e-07
x = 0
pref = []
lvl = []
gp = []
ans = []
f = 0
w = []

def dfs(i, prod, rem, n):
	if rem == 0:
		while i < len(n):
			prod *= int(n[i])
			i += 1
		return prod
	if i == len(n):
		return prod
	mx = 0
	for j in range(9 - int(n[i])):
		mx = max(dfs(i + 1, (int(n[i]) + min(j, rem)) * prod, rem - min(j, rem), n), mx)
	return mx

def hnbhai(tc):
	(x, y) = sd()
	if x == y:
		print('YES')
		return
	b = bin(x)[2:]
	t = 0
	for i in range(len(b) - 1, -1, -1):
		if b[i] == '1':
			break
		t += 1
	d = b[:len(b) - t]
	e = '1' + b[::-1]
	c = d[::-1]
	z1 = int(c, 2)
	z2 = int(e, 2)
	if z1 == y or z2 == y:
		print('YES')
		return
	d = bin(y)[2:]
	f = e[::-1]
	g = c[::-1]
	if c not in d and e not in d and (f not in d) and (g not in d):
		print('NO')
		return
	if c in d:
		idx = d.index(c)
		flag = 1
		for i in range(idx):
			if d[i] == '0':
				flag = 0
		for i in range(idx + len(c), len(d)):
			if d[i] == '0':
				flag = 0
		if flag:
			print('YES')
			return
	c = e
	if c in d:
		idx = d.index(c)
		flag = 1
		for i in range(idx):
			if d[i] == '0':
				flag = 0
		for i in range(idx + len(c), len(d)):
			if d[i] == '0':
				flag = 0
		if flag:
			print('YES')
			return
	c = f
	if c in d:
		idx = d.index(c)
		flag = 1
		for i in range(idx):
			if d[i] == '0':
				flag = 0
		for i in range(idx + len(c), len(d)):
			if d[i] == '0':
				flag = 0
		if flag:
			print('YES')
			return
	c = g
	if c in d:
		idx = d.index(c)
		flag = 1
		for i in range(idx):
			if d[i] == '0':
				flag = 0
		for i in range(idx + len(c), len(d)):
			if d[i] == '0':
				flag = 0
		if flag:
			print('YES')
			return
	print('NO')
for _ in range(1):
	hnbhai(_ + 1)


(x, y) = map(int, input().split())
if x == y:
	print('YES')
	exit()
x = format(x, 'b')
y = format(y, 'b')

def func(s):
	res = []
	s = list(s)
	ns = s + ['0']
	while ns[-1] == '0':
		ns.pop()
	ns.reverse()
	res.append(''.join(ns))
	s += ['1']
	s.reverse()
	res.append(''.join(s))
	return res
from collections import deque
q = deque([])
q.append((x, 0))
visit = set()
visit.add(x)
cnt = 0
while q:
	(v, d) = q.popleft()
	if v == y:
		print('YES')
		exit()
	if d >= 100:
		break
	for u in func(v):
		if u not in visit:
			q.append((u, d + 1))
			visit.add(u)
print('NO')


(x, y) = map(int, input().split())
x = bin(x)[2:]
y = bin(y)[2:]
if x == y:
	print('YES')
	exit(0)
for var in [x + '1', x.strip('0')]:
	for left in range(len(y) - len(var) + 1):
		right = len(y) - len(var) - left
		if '1' * left + var + '1' * right == y or '1' * left + var[::-1] + '1' * right == y:
			print('YES')
			exit(0)
print('NO')


import os, 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))
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from math import inf
from collections import defaultdict as dd

class main:

	def __init__(self, a, b):
		self.a = a
		self.b = b
		self.solve()

	def solve(self):
		if self.a == self.b:
			print('YES')
			return
		a = bin(self.a)[2:]
		N = 64
		a = list(a)
		a.append('0')
		while a and a[-1] == '0':
			a.pop()
			check = ''.join(a)
			for i in range(N):
				for j in range(N):
					if not (j == 0 and check[-1] == '0'):
						val = '0b' + '1' * i + check + '1' * j
						val = int(val, 2)
						if val == self.b:
							print('YES')
							return
					if not (i == 0 and check[-1] != '0'):
						rev = check[::-1]
						val = '0b' + '1' * i + rev + '1' * j
						val = int(val, 2)
						if val == self.b:
							print('YES')
							return
			break
		while a and a[-1] == '0':
			a.pop()
		check = ''.join(a)
		for i in range(N):
			for j in range(N):
				val = '0b' + '1' * i + check + '1' * j
				val = int(val, 2)
				if val == self.b:
					print('YES')
					return
				rev = check[::-1]
				val = '0b' + '1' * i + rev + '1' * j
				val = int(val, 2)
				if val == self.b:
					print('YES')
					return
		print('NO')
t = 1
for _ in range(t):
	(a, b) = iia()
	main(a, b)


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
import bisect, string, math, time, functools, random, fractions
from bisect import *
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def I():
	return int(input())

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

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

def LI_():
	return [int(i) - 1 for i in input().split()]

def S_():
	return input()

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

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

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 10
	n = random.randint(2, N)
	mn = 1
	mx = 5
	a = [random.randint(mn, mx) for i in range(n)]
	s = [random.randint(mn, mx) for i in range(n)]
	return (n, a, s)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			(x, y) = a1
			(z, w) = a2
			cm = Comb(max(x, z))
			if cm.comb(x, y) == cm.comb(z, w):
				case += 1
				continue
			print(inp)
			print('naive', a1)
			print('solve', a2)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def RE(E):
	rt = [[] for i in range(len(E))]
	for i in range(len(E)):
		for (nb, d) in E[i]:
			rt[nb] += ((i, d),)
	return rt

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
mo = 998244353
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
alp = [chr(ord('a') + i) for i in range(26)]
show_flg = False
show_flg = True
ans = 0
(x, y) = LI()

def solve(x, y, p):
	if x == y or x[::-1] == y:
		return True
	nx = len(x)
	ny = len(y)
	if x[-1] != '0':
		if y.find(x) == -1 and y.find(x[::-1]) == -1:
			return False
		d = ny - nx
		for l in range(ny - nx + 1):
			if all([i == '1' for i in y[:l]]) and all([i == '1' for i in y[l + nx:]]) and (y[l:l + nx] == x):
				return True
		return False
	else:
		rx = str(int(bin(int(x, 2))[2:][::-1]))
		adx = (x + '1')[::-1]
		return solve(rx, y, 0) or solve(rx[::-1], y, 0) or solve(adx, y, 0) or solve(adx[::-1], y, 0)
	return False
Yn(solve(bin(x)[2:], bin(y)[2:], 0))


import sys
import collections

def rev(x):
	ret = 0
	while x:
		ret = ret * 2 + (x & 1)
		x >>= 1
	return ret

def solve(x, y):
	if x == y:
		return True
	q = collections.deque([x])
	vis = {x}
	while q:
		n = q.popleft()
		(n1, n2) = (n << 1, n << 1 | 1)
		(n3, n4) = (rev(n1), rev(n2))
		n1 = rev(n3)
		for nn in [n1, n2, n3, n4]:
			if nn == y:
				return True
			else:
				if nn > y or nn in vis:
					continue
				vis.add(nn)
				q.append(nn)
	return False
(x, y) = map(int, sys.stdin.readline().split())
if solve(x, y):
	print('YES')
else:
	print('NO')