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).

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

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

NoteIn the first example, you don't even need to do anything.The fourth example is described in the statement.

# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# |AUTHOR|
# |      |
# |      |
# |      |
# |      |
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# MUHAMMAD AMMAR
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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')

from sys import stdin,stdout
from collections import defaultdict
input=stdin.readline
#print=stdout.write
###-----------Code Begins----------##

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

def checkpossible(XX, targety):
    x= XX
    startx= []
    while(x>0):
        startx.append(str(x&1))
        x=x>>1
    startx.reverse()
    startx = "".join(startx)
    if(len(startx)>len(targety)):
        return False

    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):
            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

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

answer = (x==y)

targety= []
while(y>0):
    targety.append(str(y&1))
    y= y>>1
targety = "".join(reversed(targety))

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")

import re
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")

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):
		# print(x)
		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:
		# print(x)
		x=(x<<1)+1
		# print(x)
		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)

x,y = [int(x) for x in input().split()]
if x==y:
    print('YES')
    exit()
# print(bin(x))
# print(bin(y))
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')

a=list(map(int,input().split()))
if a[0]==a[1]:
    print("YES")
    quit()
xx = bin(a[0])[2:]
yy = bin(a[1])[2:]
for q in [xx+'1',xx.strip('0')]:
    for l in range(len(yy) - len(q) + 1):
        r=len(yy) - len(q) - l
        if '1'*l+q+'1'*r==yy or '1'*l+q[::-1]+'1'*r==yy:
            print("YES")
            quit()
else:
    print("NO")

x,y=map(int,input().split())
if x==y:
    print("YES")
else:
    s=bin(x)[2:]
    t=bin(y)[2:]
    for q in [s+"1",s.strip('0')]:
        for l in range(len(t)-len(q)+1):
            r=len(t)-len(q)-l
            if '1'*l + q + '1'*r == t or '1'*l + q[::-1] + '1'*r == t:
                print("Yes")
                exit(0)
    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")  # for fast input
def out(var): sys.stdout.write(str(var))  # for fast output, always take string
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
    #how_much_noob_I_am = inpu()
    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")
# endregion
if __name__ == '__main__':
    main()

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")

#!/usr/bin/env python3
# from typing import *

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)

# _INPUT = """3165137368662540 34690334760256012
# """
# sys.stdin = io.StringIO(_INPUT)

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

x, y = map(int, input().split())
s = bin(y)[2:]
t = bin(x)[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")

x, y = map(int, input().split())
if x == y:
    print("YES")
else:
    a = ""
    f = 0
    for i in range(64, -1, -1):
        if x & (1 << i):
            f = 1
            a += '1'
        elif f:
            a += '0'
    b = a
    if b[-1] == '0':
        b += '1'

    while a[-1] == '0':
        a = a[:-1]

    def func():
        for i in range(64):
            for j in range(64):
                c = '1'*i + a + '1'*j
                d = '1'*i + b + '1'*j

                if len(c) < 64:
                    n1 = int(c, 2)
                    n2 = int(c[::-1], 2)
                    if n1 == y or n2 == y:
                        print("YES")
                        return 1
                if len(d) < 64:
                    n1 = int(d, 2)
                    n2 = int(d[::-1], 2)
                    if n1 == y or n2 == y:
                        print("YES")
                        return 1

    if not func():
        print("NO")

# https://codeforces.com/problemset/problem/1618/F

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

if __name__ == '__main__':
    x, y = map(int, input().split())
    print('YES' if solve(x, y) 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")

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')

if __name__ == '__main__':
    solve()

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")

# Ripped from tutorial
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")

import sys
import math
from math import factorial, inf, gcd, sqrt
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
from bisect import *
import random
from sys import stdin, stdout

sys.setrecursionlimit(10**5)

def inp():
    return stdin.readline().strip()

def iinp():
    return int(inp())

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

def lmp():
    return list(mp())

# t = iinp()
t = 1
for ii in range(t):
    x, y = mp()
    if x == y:
        print('YES')
        continue
    if x == 0 or y == 0:
        print('NO')
        continue
    x = format(x, 'b')
    y = format(y, 'b')
    if all(i == '1' for i in x):
        print('YES' if all(i == '1' for i in y) else 'NO')
        continue
    x0 = []
    for i, j in enumerate(x):
        if j == '0':
            x0.append(i)
    y0 = []
    for i, j in enumerate(y):
        if j == '0':
            y0.append(i)
    y1 = []
    for i in range(len(y)):
        if y[len(y) - 1 - i] == '0':
            y1.append(i)
    m, n = len(x0), len(y0)
    t = x[::-1].find('1')
    if m != n and m != n + t:
        print('NO')
        continue
    cy0 = [i - y0[0] + x0[0] for i in y0]
    cy1 = [i - y1[0] + x0[0] for i in y1]
    if t == len(x0):
        print('YES' if len(y) >= len(x) - t and all(i == '1'
                                                    for i in y) else 'NO')
    elif t == 0:
        print('YES' if ((cy0 == x0 and y0[0] >= x0[0]) or (
            cy1 == x0 and y1[0] >= x0[0])) else 'NO')
    else:
        if m == n:
            print('YES' if ((cy0 == x0 and y0[0] >= x0[0] and y1[0] > 0) or (
                cy1 == x0 and y1[0] >= x0[0] and y0[0] > 0)) else 'NO')
        else:
            print('YES' if ((cy0 == x0[:n] and y0[0] >= x0[0]) or (
                cy1 == x0[:n] and y1[0] >= x0[0])) else '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,math,itertools
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right
from heapq import heappop,heappush,heapify
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split()))
def inps(): return sys.stdin.readline()
def inpsl(x): tmp = sys.stdin.readline(); return list(tmp[:x])
def err(x): print(x); exit()

x,y = inpl()
x = bin(x); x = x[2:]
y = bin(y); y = y[2:]
ln = len(y)

seen = set()
q = deque([x])
while q:
    num = q.popleft()
    if num == y:
        err('YES')
    for i in ['0','1']:
        now = num + i
        now = int(now[::-1],2)
        now = bin(now)
        now = now[2:]
        if now == y:
            err('YES')
        if len(now) > ln or now in seen:
            continue
        seen.add(now)
        q.append(now)
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')

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 solve(x, y):
    if x == y:
        return "YES"

    ax = bin(x)[2:]
    ay = bin(y)[2:]

    for s in [ax+'1', ax.strip('0'), ax[::-1]+'1', ax[::-1].strip('0')]:
        if s in ay:
            aay = ay.replace(s, '')
            if aay.count('0') == 0:
                return "YES"

    return "NO"

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

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")

maxx = 10**20

def binary(x):
	ans = []
	while x:
		ans.append(str(x%2))
		x /= 2
	return ans[::-1]

def find(x):
	bin0 = binary(x)
	bin1 = bin0+['0']
	bin2 = bin0+['1']
	bin1 = bin1[::-1]
	bin2 = bin2[::-1]
	bin1 = int("".join(bin1), 2)
	bin2 = int("".join(bin2), 2)
	return bin1, bin2

x, y = [int(x) for x in raw_input().split()]
visited = set()
queue = [x]
while queue:
	u = queue.pop()
	if u in visited or u > maxx:
		continue
	visited.add(u)
	a, b = find(u)
	queue.append(a)
	queue.append(b)
if y in visited:
	print "YES"
else:
	print "NO"

#import io,os
#input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
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

#    print(dic)

    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)

 #   print(dic)

    if sy in dic:
        print("YES")
    else:
        print("NO")

T = 1 #int(input())
t = 1
while t<=T:
    main(t)
    t += 1

import sys
from sys import stdin
import math

def rev(x):

    ret = 0
    while x:
        ret *= 2
        ret += x % 2
        x //= 2
    return ret

def zcnt(x):
    ret = 0
    for i in x:
        if i == "0":
            ret += 1
    return ret

def match(x,y): #x in y?

    if zcnt(x) != zcnt(y):
        return False
    return x in y

def strev(S):

    ret = []
    for i in S:
        ret.append(i)
    ret.reverse()
    return "".join(ret)

tt = 1 #int(stdin.readline())

ANS = []

for loop in range(tt):

    x,y = map(int,stdin.readline().split())

    ans = "NO"
    if x == y:
        ans = "YES"

    X = format(x*2+1,"b")
    X2 = strev(X)

    RX = format(rev(x),"b")
    RX2 = strev(RX)
    Y = format(y,"b")

    #print (X,RX,X2,RX2,Y)

    if match(X,Y) or match(RX,Y) or match(X2,Y) or match(RX2,Y):
        ans = "YES"
    ANS.append(ans)

print ("\n".join(ANS))

#Fast I/O
import sys,os
import math
# To enable the file I/O i the below 2 lines are uncommented.
# read from in.txt if uncommented
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
# will print on Console if file I/O is not activated
#if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')

# inputs template
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))

# Sample Inputs/Output

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

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

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

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

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

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

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
#for array of integers
def MI():return (map(int,input().split()))
def mi():return int(input())

# endregion
#for fast output, always take string
def outP(var): sys.stdout.write(str(var)+'\n')
# end of any user-defined functions

MOD=10**9+7
mod=998244353

# main functions for execution of the program.

if __name__ == '__main__':
    #This doesn't works here but works wonders when submitted on CodeChef or CodeForces
    main()

from sys import stdin
inp = stdin.readline

a, b = map(int, inp().split())

binA = str(bin(a))[2:]
binB = str(bin(b))[2:]

c1 = binA.strip("0")
c2 = binA + "1"

x = binB.find(c2)
y = binB.find(c2[::-1])
done = 0

if x > -1:
    if (binB[:x] + binB[x+len(c2):]).find("0") == -1:
        done = 1

if y > -1:
    if (binB[:y] + binB[y+len(c2):]).find("0") == -1:
        done = 1

if a == b:
    done = 1

if not done:
    x = binB.find(c1)
    y = binB.find(c1[::-1])
    if x > -1:
        if (binB[:x] + binB[x + len(c1):]).find("0") == -1:
            done = 1

    if y > -1:
        if (binB[:y] + binB[y + len(c1):]).find("0") == -1:
            done = 1

if done:
    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 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

#
# sys.setrecursionlimit(10 ** 9)
decimal.getcontext().rounding = decimal.ROUND_HALF_UP

graphDict = collections.defaultdict

queue = collections.deque

################## pypy deep recursion handling ##############
# Author = @pajenegod
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

################## Graphs ###################
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
        else:
            if len(self.graph[nodes]) == 1 and parity % 2 == 0:
                if q == 1:
                    colors[nodes] = 1
                else:
                    colors[nodes] = -1
                    count += 1
            else:
                if 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

################### Tree Implementaion ##############
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

################## Union Find #######################
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

######################################################################################

'''
Knowledge and awareness are vague, and perhaps better called illusions.
Everyone lives within their own subjective interpretation.
                                                            ~Uchiha Itachi
'''

################################ <fast I/O> ###########################################
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)

#############################################<I/O Region >##############################################

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

######################################## Solution ####################################

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]
# print(bin_x)
# print(bin_y)
# print(temp)
# print(temp1)
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")

#!/usr/bin/env python3
# from typing import *

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)

# _INPUT = """8935891487501725 71487131900013807
# """
# sys.stdin = io.StringIO(_INPUT)

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)
    # print(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))

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")

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")

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")

x,y = map(int, input().split())
if x == y:
    print("YES")
else:
    # while y%4 == 3:
    #     y = (y-1)//2
    # if y%2 == 1:
    #     y = int(bin(y)[2:][::-1],2)
    #     while y%4 == 3:
    #         y = (y-1)//2
    bx1 = int(bin(x)[2:][::-1],2)
    bx2 = int(bin(bx1)[2:][::-1],2)
    bx3 = int(bin(x)[2:]+"1",2)
    bx4 = int(bin(bx3)[2:][::-1],2)
    bx1 = bin(bx1)[2:]
    bx2 = bin(bx2)[2:]
    bx3 = bin(bx3)[2:]
    bx4 = bin(bx4)[2:]
    # print(bin(y))
    # print("BXi")
    # print(bx1)
    # print(bx2)
    # print(bx3)
    # print(bx4)

    found = False
    if not found and bx1 in bin(y)[2:]:
        temp = bin(y)[2:]
        temp = temp.replace(bx1,"")
        found =True
        for char in temp:
            if char !="1":
                found = False
    if not found and bx2 in bin(y)[2:]:
        temp = bin(y)[2:]
        temp = temp.replace(bx2,"")
        found =True
        for char in temp:
            if char !="1":
                found = False
    if not found and bx3 in bin(y)[2:]:
        temp = bin(y)[2:]
        temp = temp.replace(bx3,"")
        found = True
        for char in temp:
            if char != "1":
                found = False
    if not found and bx4 in bin(y)[2:]:
        temp = bin(y)[2:]
        temp = temp.replace(bx4,"")
        found =True
        for char in temp:
            if char !="1":
                found = False
    if found:
        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]
# print(x)
# print(y)
# print(s,s1,s3,s4)
if(x==y or f(s,y) or f(s1,y) or f(s3,y) or f(s4,y)):
	print("YES")
else:
	print("NO")

#!/usr/bin/env python3

from collections import deque
import functools
import itertools
import math

def main():
    s, t = [f"{int(x):b}" for x in input().split()]

    vis = {s}
    q = deque([s])
    while q:
        x = q.pop()

        y = x[::-1].lstrip("0")
        z = (x + "1")[::-1].lstrip("0")
        for i in [y, z]:
            # No actually 60 should be fine
            if len(i) <= 60 and i not in vis:
                vis.add(i)
                q.append(i)
    if t in vis: print("YES")
    else: print("NO")

if __name__ == "__main__": main()

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

# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# |AUTHOR|
# |      |
# |      |
# |      |
# |      |
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# MUHAMMAD AMMAR
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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=''
    #FinalCF=list(FinalCF)
    if a==b or MATCHING_DEVICE.fullmatch(Formated_Str, Binofb):
            print('YES')
    else:
        print('NO')

from sys import stdin
raw_input = lambda: stdin.readline().rstrip()
input = lambda: int(raw_input())
I=lambda: map(int, raw_input().split())

def rev(n):
	return int((bin(n)[2:])[::-1], 2)

x,y = I()
x1 = x
while x1%2==0:
	x1//=2
if y==x or y==x1 or y==rev(x) or y==rev(x1):
	print 'YES'
	exit()
ok = False
done = False
x2 = x
while not done:
	xr = rev(x2)
	while xr<y or rev(xr)<y:
		xr = 2*xr+1
		if xr==y or rev(xr)==y:
			ok = True
			break
	if ok:
		break
	x2 = 2*x2 + 1
	if x2==y or rev(x2)==y:
		ok = True
		break
	if x2>y and rev(x2)>y:
		break

if ok:
	print 'YES'
	exit()

done = False
x2 = x1
while not done:
	xr = rev(x2)
	while xr<y or rev(xr)<y:
		xr = 2*xr+1
		if xr==y or rev(xr)==y:
			ok = True
			break
	if ok:
		break
	x2 = 2*x2 + 1
	if x2==y or rev(x2)==y:
		ok = True
		break
	if x2>y and rev(x2)>y:
		break

xr1 = rev(x)
done = False
x2 = xr1
while not done:
	xr = rev(x2)
	while xr<y or rev(xr)<y:
		xr = 2*xr+1
		if xr==y or rev(xr)==y:
			ok = True
			break
	if ok:
		break
	x2 = 2*x2 + 1
	if x2==y or rev(x2)==y:
		ok = True
		break
	if x2>y and rev(x2)>y:
		break

xr2 = rev(x1)
done = False
x2 = xr2
while not done:
	xr = rev(x2)
	while xr<y or rev(xr)<y:
		xr = 2*xr+1
		if xr==y or rev(xr)==y:
			ok = True
			break
	if ok:
		break
	x2 = 2*x2 + 1
	if x2==y or rev(x2)==y:
		ok = True
		break
	if x2>y and rev(x2)>y:
		break

# print bin(x)
# print bin(x1)
# print bin(rev(x))
# print bin(rev(x1))
# print
# print bin(y)
# print

if ok:
	print 'YES'
else:
	print 'NO'

import math

def solve():
    x, y = input().split()
    x = int(x)
    y = int(y)

    if x == y:
        print('YES')
        return

    x = str(bin(x))[2:]
    y = str(bin(y))[2:]

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

    print('No')

if __name__ == '__main__':
    #T = int(input())
    T = 1
    while T > 0:
        T -= 1
        solve()

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

def transit(s1, s2):
    a1 = s1.split("0")
    a2 = s2.split("0")
    sl1, sr1 = a1[0], a1[-1]
    sl2, sr2 = a2[0], a2[-1]

    if len(sl1) <= len(sl2) and len(sr1) <= len(sr2):
        if s1.strip("1") == s2.strip("1"):
            return True
    return False

if a == b:
    print("yEs")
else:
    k = [a.rstrip("0"), a + "1"]
    for i in k.copy():
        k.append(i[::-1])

    for el in k:
        if transit(el, b):
            print("YEs")
            break
    else:
        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")

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')

from collections import deque

a, b = map(int, input().split())

a = str(bin(a))[2:]
b = str(bin(b))[2:]

q = deque()
q.append(a)
ans = "NO"

seen = set()

while q:
    s = q.pop()
    if s == b:
        ans = "YES"
        break

    if len(s) <= 100 and s not in seen:
        q.append(str(s + "1")[::-1])
        q.append(bin(int(s[::-1], 2))[2:])

    seen.add(s)

print(ans)

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")

def dfs(start=0,goal=None):
    used=set()
    p,t=start,0
    used.add(p)
    next_set=[p]
    if p==goal:
        return True
    while next_set:
        p=next_set.pop()
        for q in make_edge(p):
            if q in used:
                continue
            if q==goal:
                return True
            used.add(q)
            next_set.append(q)
    return False

import sys
input = sys.stdin.readline
import string

numbers = string.digits                                                 # [0-9] をロード

def base_cvt_from_10(value, n=2, output=numbers):                            # n=26, output=abc で、[a-z]表示の26進数を生成可能
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)                       # 整数以外はアウト

    if n < 2 or n > len(output):                                        # 62進数まで対応。
        raise ValueError('Invalid n:', value)

    coef = []
    while tmp >= n:
        idx = tmp % n                                                    # tmp = a_k n^k + ... a_1 n^1 + a_0 n^0 の a_0 の値を取り出す
        coef.append(idx)
        tmp = tmp // n                                                   # a_k n^k + ... a_1 n^1 + a_0 n^0 ⇒ a_k n^k + ... a_1 n^1 :最小桁を消去してループ
    idx = tmp % n
    coef.append(idx)                                                     # coef = [a_0, a_1, ... , a_k]
    res = list(map(lambda x: output[x], reversed(coef)))              # リストの順序と文字列の順序は逆なので reversed が必要
    return res

def make_edge(s):
    bit=base_cvt_from_10(s)
    tmp=reversed(bit)
    tmp="".join(tmp)
    tmp=int(tmp,2)
    if tmp<T*4:
        yield tmp
    bit+=["1"]
    tmp=reversed(bit)
    tmp="".join(tmp)
    tmp=int(tmp,2)
    if tmp<T*4:
        yield tmp

S,T=map(int, input().split())

res=dfs(start=S,goal=T)
print("YES" if res else "NO")

import sys
input = lambda : sys.stdin.readline().rstrip()
x, y = map(int, input().split())
if x == y:
    print('YES')
    sys.exit(0)
b = bin(x)[2:]+'1'
while x & 1 == 0:
    x >>= 1
a = bin(x)[2:]
y = bin(y)[2:]

def check(s):
    idx = y.find(s)
    if idx == -1:
        return False
    for i, e in enumerate(y):
        if idx<=i<idx+len(s):
            continue
        if e == '0':
            return False
    return True

for s in [a, b, a[::-1], b[::-1]]:
    if check(s):
        print('YES')
        sys.exit(0)
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 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
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# input = sys.stdin.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 n > m:
    #     return False
    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

# sys.setrecursionlimit(200010)
# https://codeforces.com/contest/1618/problem/F
def main():
    test = 1

    for idt in range(test):
        # n = int(input())
        a, b = map(int, input().split())
        # a = list(map(int, input().split()))
        stt = bin(a)[2:]
        end = bin(b)[2:]
        # print(stt)
        # print(end)
        if work(stt, end):
            print("YES")
        else:
            print("NO")
    return

if __name__ == '__main__':
    main()

def check(sa, sb):
    for i in range(len(sb)):
        for j in range(i, len(sb)):
            if (sb[i:j + 1] == sa or sb[i:j + 1] == sa[::-1]) and "0" not in sb[:i] and "0" not in sb[j + 1:]:
                return True
    return False
a, b = map(int, input().split())
if a == b:
    print("YES")
    exit()
sa = bin(a)[2:]
sb = bin(b)[2:]
ta = sa
while ta[-1] == "0":
    ta = ta[:-1]
if check(sa + "1", sb) or check(ta, sb):
    print("YES")
else:
    print("NO")

a, b = map(int, input().split())
if a == b:
    print("YES")
    quit()
a1 = bin(a)[2:] + '1'
a = bin(a)[2:].rstrip('0')
a1r = a1[::-1]
ar = a[::-1]
b = bin(b)[2:]
b0 = b.count('0')
a0 = a.count('0')
a10 = a1.count('0')
if (a in b and a0 == b0) or (ar in b and a0 == b0) or (a1 in b and a10 == b0) or (a1r in b and a10 == b0):
    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]
# print(x)
# print(y)
# print(s,s1,s3,s4)
if(x==y or f(s,y) or f(s1,y) or f(s3,y) or f(s4,y)):
	print("YES")
else:
	print("NO")

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')

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

if x==y:
  print('YES')
  exit()

for i in range(64):
  for j in range(1,64):
    if ['1']*i+x+['1']*j==y:
      print('YES')
      exit()
    if ['1']*j+x[::-1]+['1']*i==y:
      print('YES')
      exit()

while x[-1]=='0':
  x.pop()

for i in range(64):
  for j in range(64):
    if ['1']*i+x+['1']*j==y:
      print('YES')
      exit()
    if ['1']*i+x[::-1]+['1']*j==y:
      print('YES')
      exit()

print('NO')

tmp=input().split()
a=format(int(tmp[0]),"b")
tar=format(int(tmp[1]),"b")
c=a+'1'
while a[-1]=='0':
    a=a[:-1]
b=a[::-1]
d=c[::-1]
def works(x):
    if not x in tar:
        return 0
    while x in tar:
        x='1'+x
    x=x[1:]
    while x in tar:
        x=x+'1'
    x=x[:-1]
    return x==tar
if works(a) or works(b) or works(c) or works(d) or c[:-1]==tar:
    print("YES")
else:
    print("NO")

a=list(map(int,input().split()))
if a[0]==a[1]:
    print("YES")
    quit()
xx = bin(a[0])[2:]
yy = bin(a[1])[2:]
for q in [xx+'1',xx.strip('0')]:
    for l in range(len(yy) - len(q) + 1):
        r=len(yy) - len(q) - l
        if '1'*l+q+'1'*r==yy or '1'*l+q[::-1]+'1'*r==yy:
            print("YES")
            quit()
else:
    print("NO")

import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = 'x' in file.mode or 'r' not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b'\n') + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode('ascii'))
        self.read = lambda: self.buffer.read().decode('ascii')
        self.readline = lambda: self.buffer.readline().decode('ascii')
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

def 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)

import os,sys
from io import BytesIO, IOBase

def find(c1,c2):
    """ find c1 in c2"""
    for i in range(len(c2)-len(c1)+1):
        if c1 == c2[i:i+len(c1)] and c2[:i] == [1]*i \
                and c2[i+len(c1):] == [1]*(len(c2)-len(c1)-i):
            return 1
    return 0

def main():
    x,y = map(int,input().split())
    if x == y:
        print('YES')
        exit()
    if not y&1:
        print('NO')
        exit()
    x = bin(x)[2:]
    y = bin(y)[2:]
    c1,ls = [],0
    for i in range(1,len(x)):
        if x[i] == '1':
            c1.append(i-ls)
            ls = i
    c2,ls = [],0
    for i in range(1,len(y)):
        if y[i] == '1':
            c2.append(i-ls)
            ls = i
    zz = 0
    for i in range(len(x)-1,-1,-1):
        if x[i] == '0':
            zz += 1
        else:
            break
    c3 = c1+[zz+1]
    print('YES' if find(c3,c2) or find(c1,c2) or find(c1[::-1],c2) or find(c3[::-1],c2) else 'NO')

# Fast IO Region
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")
if __name__ == "__main__":
    main()

x, y = map(int, input().split())
x = bin(x,)[2:]
y = bin(y,)[2:]
l = 0;
n = -len(x)
ox = x + '1'
ok = x == y
if(ox in y):
    i = y.index(ox)
    if not( '0' in y[:i] or '0' in y[i + len(ox):]): ok = True
ox = ox[::-1]
if ox in y:
    i = y.index(ox)
    if not( '0' in y[:i] or '0' in y[i + len(ox):]): ok = True

while l >= n and x[l-1] == '0':
    l-=1
if l!= 0: x = x[:l]
if x in y:
    i = y.index(x)
    if not( '0' in y[:i] or '0' in y[i + len(x):]): ok = True
x = x[::-1]
if x in y:
    i = y.index(x)
    if not( '0' in y[:i] or '0' in y[i + len(x):]): ok = True

print("Yes" if ok else "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 io,os
#input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

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

import sys
import math
from math import factorial, inf, gcd, sqrt
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
from bisect import *
import random
from sys import stdin, stdout

sys.setrecursionlimit(10**5)

def inp():
    return stdin.readline().strip()

def iinp():
    return int(inp())

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

def lmp():
    return list(mp())

# t = iinp()
t = 1
for ii in range(t):
    x, y = mp()
    if x == y:
        print('YES')
        continue
    if x == 0 or y == 0:
        print('NO')
        continue
    x = format(x, 'b')
    y = format(y, 'b')
    x0, y0 = x.count('0'), y.count('0')
    t = x[::-1].find('1')
    if y0 != x0 and y0 + t != x0:
        print('NO')
        continue
    m, n = len(x), len(y)
    if t == 0:
        if x in y or x[::-1] in y:
            print('YES')
        else:
            print('NO')
        continue
    i = y.find(x)
    if i != -1 and i + m < n:
        print('YES')
        continue
    i = y.find(x[::-1])
    if i != -1 and i > 0:
        print('YES')
        continue
    x = x[:m - t]
    print('YES' if x0 == y0 + t and (x in y or x[::-1] in y) else 'NO')

s = input()
nums = [int(x) for x in s.split()]
a = str(bin(nums[0]))[2:]
b = str(bin(nums[1]))[2:]
ax = a.rstrip("0")
ay = a + "1"
ans = "NO"
#print(a, b, ax, ay)
if all(c in '1' for c in b.replace(ax, "", 1)) and b != b.replace(ax, "", 1):
    ans = "YES"
ax = ax[::-1]
if all(c in '1' for c in b.replace(ax, "", 1)) and b != b.replace(ax, "", 1):
    ans = "YES"
ax = a + "1"
if all(c in '1' for c in b.replace(ax, "", 1)) and b != b.replace(ax, "", 1):
    ans = "YES"
ax = ax[::-1]
if all(c in '1' for c in b.replace(ax, "", 1)) and b != b.replace(ax, "", 1):
    ans = "YES"
if a == b:
    ans = "YES"
print(ans)

a, b = map(int, input().split())

bina = bin(b)[2::]
binb = bin(a)[2::]

if (bina == binb):
  print("YES")
  exit(0)
else:

  for q in [binb + '1', binb.rstrip('0')]:

    for l in range(len(bina) - len(q) + 1):
      r = len(bina) - len(q) - l
      if (l*'1' + q +  r*'1' == bina) or (l*'1' + q[::-1] +  r*'1' == bina):
        print("YES")
        exit(0)

print("NO")

a, b = map(int, input().split())
s = bin(b)[2:]
t = bin(a)[2:]
#print(s)
#print(t)
if s == t:
    print("YES")
    exit(0)

q=t+'1'
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)

q=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")

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

def dfs(x, y):
    vis.add(x)
    rev, nxt, cp = 0, 0, x
    while x:
        rev = rev * 2 + x % 2
        x //= 2
    x = 2 * cp + 1
    while x:
        nxt = nxt * 2 + x % 2
        x //= 2
    x = cp
    if x > y:
        if rev not in vis:
            dfs(rev, y)
    elif x == y:
        return
    else:
        if rev not in vis:
            dfs(rev, y)
        if nxt not in vis:
            dfs(nxt, y)

x, y = (int(x) for x in input().split())
vis = {x}
dfs(x, y)
print("YES" if y in vis else "NO")

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

from bisect import bisect_left as lower_bound, bisect_right as upper_bound
def so():  return int(input())
def st():  return input()
def mj():  return map(int,input().strip().split(" "))
def msj(): return list(map(str,input().strip().split(" ")))
def le():  return list(map(int,input().split()))
def rc():  return map(float,input().split())
def lebe():return list(map(int, input()))

def dmain():
    sys.setrecursionlimit(1000000)
    threading.stack_size(1024000)
    thread = threading.Thread(target=main)
    thread.start()
def joro(L):
    return(''.join(map(str, L)))

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

def isprime(n):
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            return False
    return True
def npr(n, r):
    return factorial(n) // factorial(n - r) if n >= r else 0

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) if n >= r else 0

def lower_bound(li, num):
    answer = -1
    start = 0
    end = len(li) - 1

    while (start <= end):
        middle = (end + start) // 2
        if li[middle] >= num:
            answer = middle
            end = middle - 1
        else:
            start = middle + 1
    return answer  # min index where x is not less than num

def upper_bound(li, num):
    answer = -1
    start = 0
    end = len(li) - 1

    while (start <= end):
        middle = (end + start) // 2

        if li[middle] <= num:
            answer = middle
            start = middle + 1

        else:
            end = middle - 1
    return answer  # max index where x is not greater than num
def tir(a,b,c):
    if(0==c):
        return 1
    if(len(a)<=b):
        return 0

    if(c!=-1):
        return (tir(a,1+b,c+a[b]) or tir(a,b+1,c-a[b]) or tir(a,1+b,c))

    else:
        return (tir(a,1+b,a[b]) or tir(a,b+1,-a[b]) or tir(a,1+b,-1))
hoi=int(2**20)

def abs(x):
    return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
    # print(lb, ub, li)
    ans = -1
    while (lb <= ub):
        mid = (lb + ub) // 2
        # print('mid is',mid, li[mid])
        if li[mid] > val:
            ub = mid - 1
        elif val > li[mid]:
            lb = mid + 1
        else:
            ans = mid  # return index
            break
    return ans

def kadane(x):  # maximum sum contiguous subarray
    sum_so_far = 0
    current_sum = 0
    for i in x:
        current_sum += i
        if current_sum < 0:
            current_sum = 0
        else:
            sum_so_far = max(sum_so_far, current_sum)
    return sum_so_far
def joker(a,b):
    L=bin(a)[2:]
    M=bin(b)[2:]
    p=len(M)
    if(a==b):
        return 1
    Q=L[::-1].lstrip("0")
    P=(L+"1")[::-1]
    #O=len(M)
    R=P[::-1]
    S=Q[::-1]
    for i in [P,Q,R,S]:
        op=len(i)
        if(p<op):
            continue

        for j in range(1+p-op):
            if(M[j+op:].count("0") == 0 and M[:j].count("0") == 0):
                if(M[j:j+op] ==i):
                    return 1
            #i=1+i
    return 0

def pref(li):
    pref_sum = [0]
    for i in li:
        pref_sum.append(pref_sum[-1] + i)
    return pref_sum

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

    for p in range(2, len(prime)):
        if prime[p]:
            li.append(p)
    return li

def primefactors(n):
    factors = []
    while (n % 2 == 0):
        factors.append(2)
        n //= 2
    for i in range(3, int(sqrt(n)) + 1, 2):  # only odd factors left
        while n % i == 0:
            factors.append(i)
            n //= i
    if n > 2:  # incase of prime
        factors.append(n)
    return factors

def read():
    sys.stdin  = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
def tr(n):
    return n*(n+1)//2
boi=int(1e9-7)
doi=int(1e9+7)

def iu():
    import sys
    import math as my
    input=sys.stdin.readline
    bj="YES"
    cj="NO"
    a,b=mj()
    if(not joker(a,b)):
        print(cj)
    else:
        print(bj)

def main():
    for i in range(1):
        iu()

# region fastio
# template taken from https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

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

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

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

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

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

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
    #dmain()

# Comment Read()

# cook your dish here
import sys
#import random
from bisect import bisect_left as lb
from bisect import bisect_right as rb
from collections import deque
#sys.setrecursionlimit(10**8)
from queue import PriorityQueue as pq
from math import gcd
#import math
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]

    #print(a,b)
    for mn in range (2) :
        t = len(a)
        #print(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
        #a1 = a
        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")

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")

# Problem: F. Развороты
# Contest: Codeforces - Codeforces Round #760 (Div. 3)
# URL: https://codeforces.com/contest/1618/problem/F
# Memory Limit: 256 MB
# Time Limit: 2000 ms
#
# Powered by CP Editor (https://cpeditor.org)

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
#t = int(input())

for i in range(t):
	solve(t)

# Fast IO Region
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)
input = lambda: sys.stdin.readline().rstrip("\r\n")
in1 = lambda : int(input())
in2 = lambda : list(map(int, input().split()))

#Solve
import math
mod = 998244353

def check(x, y):
    b1 = bin(x)[2:]
    b2 = bin(y)[2:]
    if len(b2) < len(b1):
            return False

    def cmp(s1, s2):
        n1 = [c for c in s1]
        n2 = [c for c in s2]
        while len(n1) > 1 and n1[0] == '1' and n1[1] == '1':
            n1.remove(n1[0])
        while len(n1) > 1 and n1[-1] == '1' and n1[-2] == '1':
            n1.pop()
        while len(n2) > 1 and n2[0] == '1' and n2[1] == '1':
            n2.remove(n2[0])
        while len(n2) > 1 and n2[-1] == '1' and n2[-2] == '1':
            n2.pop()
        if len(n1) != len(n2):
            return False
        for i in range(len(n1)):
            if n1[i] != n2[i]:
                return False
        return True

    return cmp(b1, b2) or cmp(reversed(b1), b2)

def main():
    x, y = in2()
    if x == y:
        print("YES")
        return
    x1 = x
    x2 = x * 2 + 1
    while x1 % 2 == 0:
        x1 //= 2

    if check(x1, y):
        print("YES")
        return
    if check(x2, y):
        print("YES")
        return
    print("NO")

if __name__ == "__main__":
    main()

def toBinary (x):
    binX = []

    while x:
        binX.append(x%2)
        x = x//2

    binX.reverse()
    return binX

def toBase (binX):

    baseX = binX.copy()
    while baseX[len(baseX)-1] == 0:
        baseX.pop(len(baseX)-1)

    return baseX

def checkOnes (binY, k, index):

    for i in range(0, index):
        if binY[i] != 1:
            return False

    for i in range(index + k, len(binY)):
        if binY[i] != 1:
            return False

    return True

def checkOnesRight (binY, k, index):

    for i in range(index + k, len(binY)):
        if binY[i] == 1:
            return True

    return False

def checkOnesLeft (binY, k, index):

    for i in range(0, index):
        if binY[i] == 1:
            return True

    return False

def checkEqual (binY, binX, mode):
# checks if binY can be obtained as 1111111..... + binX + ......111111111

    index = -1
    for i in range (len(binY)-len(binX)+1):
        temp = binY[i:i+len(binX)]

        if temp == binX:
            index = i
            break

    if index == -1:
        return False

    if checkOnes(binY, len(binX), index):
        if mode == 0:
            return True

        elif mode == 1:
            if checkOnesRight(binY, len(binX), index):
                return True
            else:
                return False

        elif mode == 2:
            if checkOnesLeft(binY, len(binX), index):
                return True
            else:
                return False
    else:
        return False

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

binX = toBinary(x)
binY = toBinary(y)
baseX = toBase(binX)

if x == y:
    print ("YES")

elif binX == baseX:

    if checkEqual (binY, binX, 0) or checkEqual (binY, list(reversed(binX)), 0 ) :
        print ("YES")

    else:
        print ("NO")

else:

    if checkEqual (binY, baseX, 0) or checkEqual (binY, list(reversed(baseX)), 0 ) :
        print ("YES")

    elif checkEqual (binY, binX, 1) or checkEqual (binY, list(reversed(binX)), 2 ) :
        print ("YES")

    else:
        print ("NO")

import sys
raw_input = iter(sys.stdin.read().splitlines()).next

def getPrefix(pattern):
    prefix = [-1]*len(pattern)
    j = -1
    for i in xrange(1, len(pattern)):
        while j != -1 and pattern[j+1] != pattern[i]:
            j = prefix[j]
        if pattern[j+1] == pattern[i]:
            j += 1
        prefix[i] = j
    return prefix

def kmp(text, pattern):
    if not pattern:
        return 0
    prefix = getPrefix(pattern)
    if len(text) < len(pattern):
        return -1
    j = -1
    for i in xrange(len(text)):
        while j != -1 and pattern[j+1] != text[i]:
            j = prefix[j]
        if pattern[j+1] == text[i]:
            j += 1
        if j+1 == len(pattern):
            return i-j
    return -1

def solution():
    x, y = map(lambda x:bin(int(x))[2:], raw_input().strip().split())
    if x == y:
        return "YES"
    for s in (x+'1', x.strip('0')):
        for t in (s, s[::-1]):
            i = kmp(y, t)
            if i != -1 and all(c == '1' for c in y[:i]+y[i+len(t):]):
                return "YES"
    return "NO"

print '%s' % solution()

import sys

def power2(x):
    return 2 * x == 1 << x.bit_length()

def string_check(x, y):
    i = -1
    while True:
        i = y.find(x, i + 1)
        if i == -1:
            break

        if all(c == '1' for c in y[:i]) and all(c == '1' for c in y[i + len(x):]):
            return True
    return False

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

def check(x, y):
    if x == y:
        return True

    if x == 0:
        return power2(y + 1)

    x1 = (x << 1) + 1
    x0 = x >> (x & -x).bit_length() - 1

    ybin = to_binary(y)
    if string_check(to_binary(x0), ybin):
        return True

    if string_check(to_binary(x0)[::-1], ybin):
        return True

    if string_check(to_binary(x1), ybin):
        return True

    if string_check(to_binary(x1)[::-1], ybin):
        return True

    return False

x,y = [int(x) for x in input().split()]
if check(x,y):
    print('YES')
else:
    print('NO')

# coding: utf-8

from re import fullmatch

x, y = map(lambda x: bin(int(x))[2:], input().split())
x0, x1 = x + '1', x.rstrip('0')
print('YES' if x == y or fullmatch(f'1*({x0}|{x1}|{x0[::-1]}|{x1[::-1]})1*', y) else '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')

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")

import collections
def solve():
    x,y=list(map(int,input().split()))
    word=''
    while x:
        #print(x)
        word+=str(x%2)
        x//=2
    word=word[::-1]
    #print('word',word)

    q=collections.deque()
    S=set()
    q.append(word)
    S.add(word)
    step=0

    while q and step<100:
        step+=1
        k=len(q)

        for _ in range(k):
            cur=q.popleft()
            if int(cur,2)==y:
                print('YES')
                return

            new1='1'+cur[::-1]
            if new1 not in S:
                q.append(new1)
                S.add(new1)

            new2=cur[::-1].lstrip('0')
            if new2 not in S:
                q.append(new2)
                S.add(new2)

    print('NO')

solve()

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]
# print(x)
# print(y)
# print(s,s1,s3,s4)
if(x==y or f(s,y) or f(s1,y) or f(s3,y) or f(s4,y)):
	print("YES")
else:
	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')

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")

import decimal
import heapq
import math
import os
import sys
from array import array
from collections import Counter, deque
from io import BytesIO, IOBase
import bisect
from types import GeneratorType

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 isPrime(n):
    if n <= 1:
        return False
    if n <= 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    i = 5
    while i * i <= n:
        if n % i == 0 or n % (i + 2) == 0:
            return False
        i = i + 6
    return True

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

def ints_get(): return map(int, input().strip().split())

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

def chars_get(): return list(map(str, sys.stdin.readline().strip().split()))

def output(to_be_printed, end="\n"): sys.stdout.write(str(to_be_printed) + end)

def ipn(): return int(input())

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

    return wrappedfunc

# ******************************************************#
# **************** code starts here ********************#
# ******************************************************#

def isSubstring(s1, s2):
    M = len(s1)
    N = len(s2)
    for i in range(N - M + 1):
        for j in range(M):
            if (s2[i + j] != s1[j]):
                break
        if j + 1 == M:
            return i

    return -1

def decimalToBinary(n):
    return "{0:b}".format(int(n))

def main():
    a, b = ints_get()
    if a == b:
        print("YES")
        return
    p, q = list(decimalToBinary(a)), list(decimalToBinary(b))
    if q[-1] == 0:
        print("NO")
        return
    flag = 0
    r = p.copy()
    r.append('1')
    while p[-1] == '0':
        p.pop()
    x = p.copy()
    p.reverse()
    # print(p, q)
    s = r.copy()
    r.reverse()
    # print(flag, p)
    if p.count('0') == q.count('0'):
        if isSubstring(p, q) != -1 or isSubstring(x, q) != -1:
            flag = 1
    # print(flag)
    if r.count('0') == q.count('0'):
        if isSubstring(r, q) != -1 or isSubstring(s, q) != -1:
            flag = 1
    if flag == 1:
        print("YES")
    else:
        print("NO")
    return

if __name__ == "__main__":
    main()

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]
#print(x, y, use)
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'
#print(x, y, use)
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')

x, y = map(int, input().split(" "))
ans = "NO"
if x == y:
    ans = "YES"
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)

a, b = map(int, input().split())

bina = bin(b)[2::]
binb = bin(a)[2::]

if (bina == binb):
  print("YES")
  exit(0)
else:

  for q in [binb + '1', binb.rstrip('0')]:

    for l in range(len(bina) - len(q) + 1):
      r = len(bina) - len(q) - l
      if (l*'1' + q +  r*'1' == bina) or (l*'1' + q[::-1] +  r*'1' == bina):
        print("YES")
        exit(0)

print("NO")

from sys import stdin
input = stdin.readline

def get_binary(x):

    binary , yes = "" , False
    for i in range(60 , -1 , -1):

        if(x >> i & 1):
            binary += '1'
            yes = True
        elif(yes):
            binary += '0'

    return binary

def check(x):

    yb = get_binary(y)
    size = len(yb)
    for i in range(size):
        for j in range(i + 1 , size + 1):

            yes = True
            for k in range(i):
                if(yb[k] == '0'):
                    yes = False
                    break

            for k in range(j , size):
                if(yb[k] == '0'):
                    yes = False
                    break

            if(not yes):continue

            value , p = 0 , 0
            for k in range(j - 1 , i - 1 , -1):
                value += (1 << p) * int(yb[k])
                p += 1

            if(value == x and yb[i] != '0'):return True

            value , p = 0 , 0
            for k in range(i , j):
                value += (1 << p) * int(yb[k])
                p += 1

            if(value == x and yb[j - 1] != '0'):return True

    return False

def answer():

    if(x == y):return 'YES'
    if(y & 1 == 0):return 'NO'

    yes = check(x)
    xb = get_binary(x)
    value , p = 0 , 0
    for i in range(len(xb)):
        value += (1 << p) * int(xb[i])
        p += 1

    if(value == y):return 'YES'
    yes |= check(value)

    if(yes):return 'YES'
    return 'NO'

for T in range(1):

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

    print(answer())

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")

import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]

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

if bin(y)[-1] == 0:
    if x!=y:
        print('NO')
    else:
        print('YES')
elif x == y:
    print('YES')
else:
    bin_x = bin(x)[2:]
    bin_y = bin(y)[2:]
    pattern = patterns(x)
    flag = False
    a = []
    b = []
    c = []
    d = []
    e = []
    for i in range(len(bin_y)):
        if bin_y[i:i+len(pattern[0])] == pattern[0]:
            a.append(i)
        if bin_y[i:i+len(pattern[1])] == pattern[1]:
            b.append(i)
        if bin_y[i:i+len(pattern[2])] == pattern[2]:
            c.append(i)
        if bin_y[i:i+len(pattern[3])] == pattern[3]:
            d.append(i)
        if bin_y[i:i+len(pattern[4])] == pattern[4]:
            e.append(i)
    for i in a:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[0]):]:
            flag = True
            break
    for i in b:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[1]):]:
            flag = True
            break
    for i in c:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[2]):]:
            flag = True
            break
    for i in d:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[3]):]:
            flag = True
            break
    for i in e:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[4]):]:
            flag = True
            break
    if flag:
        print('YES')
    else:
        print('NO')

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

a = bin(x)[2:]
b = bin(y)[2:]

#print(a)
#print(b)

flag = 0
for p in [a+'1', a.strip('0')]:
    for i in range( len(b)-len(p)+1 ):
        if '1'*i + p + '1'*(len(b)-len(p)-i) == b:
            flag = 1

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

#!/usr/bin/env python3

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]:
        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]:
            print("YES")
            break
    else:
        print("NO")

# import sys, os

# from sympy import solve
# if not os.environ.get("ONLINE_JUDGE"):
#     sys.stdin = open('in.txt', 'r')
#     sys.stdout = open('out.txt', 'w')

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

def solve(s, y):
    if s == y:
        return True
    if len(s) > len(y):
        return False
    n = len(y) - len(s)
    for i in range(n):
        if y == '1'*i + s + '1'*(n-i):
            return True
    return False

n, k = map(int, input().split())
x = bin(n).replace('0b', '')
y = bin(k).replace('0b', '')

if x == y:
    print("YES")
else:
    s1 = x + '1'
    s2 = s1[::-1]
    x = bin(int(x[::-1], 2)).replace('0b', '')
    s3 = x
    s4 = s3[::-1]

    if solve(s1, y) or solve(s2, y) or solve(s3, y) or solve(s4, y):
        print("YES")
    else:
        print("NO")

def solve(x, y):
    if x == y:
        return True
    x = bin(x)[2:]
    y = bin(y)[2:]
    xx = x.rstrip('0')
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    xx = xx[::-1]
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    xx = x[::-1]
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    return False

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

def I(): return input().strip()
def II(): return int(input().strip())
def LI(): return [*map(int, input().strip().split())]
import sys, os, copy, string, math, time, functools, fractions
input = sys.stdin.readline
from io import BytesIO, IOBase
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter, OrderedDict
from itertools import permutations, chain, combinations, groupby
from operator import itemgetter
from types import GeneratorType  # for recursion
from typing import Iterable, TypeVar, Union  # for sorted set

# template starts

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 bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrappedfunc

# template ends

def compare(a, b):
    if len(a) > len(b):
        return False
    if len(a) == len(b):
        if a == b or a == b[::-1]:
            return True
        return False
    if b.find(a) != -1:
        start = b.find(a)
        flag = True
        for i in range(start):
            if b[i] != '1':
                flag = False
        for i in range(start + len(a), len(b)):
            if b[i] != '1':
                flag = False
        if flag:
            return True
    a = a[::-1]
    if b.find(a) != -1:
        start = b.find(a)
        flag = True
        for i in range(start):
            if b[i] != '1':
                flag = False
        for i in range(start + len(a), len(b)):
            if b[i] != '1':
                flag = False
        if flag:
            return True
    return False

def main():
    x, y = LI()
    bx = bin(x).replace("0b", "")
    by = bin(y).replace("0b", "")
    if bx[-1] == '1':
        if compare(bx, by):
            print('YES')
            return
    if bx[-1] == '0':
        if compare(bx + '1', by):
            print('YES')
            return
        if compare(bx.strip('0'), by):
            print('YES')
            return
    print('NO')

for _ in range(1):
    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())

# 34 = 100010
# 69 = 1000101

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)])
            #print(new_s1)
            if new_s1 == s2 or new_s1[::-1] == s2:
                return True

    return False

def trywithspecial(s1, s2):

    if s2[-1] == '0' and s1 == s2:
        return False

    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)])
            #print(new_s1)
            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")

if __name__ == '__main__':
    #T = int(input())
    T=1
    for _ in range(T):
        solve()

# Fast IO Region
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)
input = lambda: sys.stdin.readline().rstrip("\r\n")
in1 = lambda : int(input())
in2 = lambda : list(map(int, input().split()))

#Solve
import math
mod = 998244353

def check(x, y):
    b1 = bin(x)[2:]
    b2 = bin(y)[2:]
    if len(b2) <= len(b1):
            return False

    def cmp(s1, s2):
        n1 = [c for c in s1]
        n2 = [c for c in s2]
        while len(n1) > 1 and n1[0] == '1' and n1[1] == '1':
            n1.remove(n1[0])
        while len(n1) > 1 and n1[-1] == '1' and n1[-2] == '1':
            n1.pop()
        while len(n2) > 1 and n2[0] == '1' and n2[1] == '1':
            n2.remove(n1[0])
        while len(n2) > 1 and n2[-1] == '1' and n2[-2] == '1':
            n2.pop()
        if len(n1) != len(n2):
            return False
        for i in range(len(n1)):
            if n1[i] != n2[i]:
                return False
        return True

    return cmp(b1, b2) or cmp(reversed(b1), b2)

def main():
    x, y = in2()
    ok = True

    if x == y:
        print("YES")
        return
    x1 = x
    x2 = x * 2 + 1
    while x1 % 2 == 0:
        x1 //= 2

    if check(x1, y):
        print("YES")
        return
    if check(x2, y):
        print("YES")
        return
    print("NO")

if __name__ == "__main__":
    main()

def dec(n):
    r = ""

    while n:
        r+=str(n%2)
        n/=2
    return r[::-1]

a,b = map(int, raw_input().split())

ok = 0

b = dec(b)
a = dec(a)

if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1

while len(a) and a[-1] == '0':
    a = a[:len(a)-1]
if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1
if len(a) == 0 and '0' not in b:
    ok = 1
if ok:
    print"YES"
else:
    print"NO"

def reverse(a):
    acm = 0
    while(a!=0):
        acm = 2*acm + a%2
        a = a//2
    return acm

a, b = [int(x) for x in input().split()]

q = [a]
i = 0
d = {}
d[a] = 1

while(i<len(q) and i<1000):
    x = q[i]

    if(reverse(x) not in d):
        d[reverse(x)] = 1
        q.append(reverse(x))

    if(reverse(2*x+1) not in d):
        d[reverse(2*x+1)] = 1
        q.append(reverse(2*x+1))

    i = i+1

if(b in d):
    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
if c==b:
    print("YES")
    exit(0)
c.reverse()
while c[-1]==0:
    c.pop()
while (y):
    b.append(y%2)
    y//=2
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
inpu = sys.stdin.readline
prin = sys.stdout.write

x, y = map(int, inpu().split())
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 sys, math
input = sys.stdin.readline

x, y = map(int, input().split())
x, y = bin(x)[2:], bin(y)[2:]
if x == y:
    print('YES')
elif y[-1] == '0':
    print('NO')
else:
    pos = x+'1' in y or x+'1' in y[::-1] or x.strip('0') in y or x.strip('0') in y[::-1]
    print('YES' if pos else 'NO')

import math

a, b = list(map(int, input().split()))
a = bin(a)[2:]
pos = [a.strip('0'), a.strip('0')[::-1], a+'1', (a+'1')[::-1]]
b = bin(b)[2:]
answer = False
for i in range(4):
    for j in range(len(b)):
        for k in range(len(b)):
            if '1'*j+pos[i]+'1'*k == b:
                answer = True
if answer:
    print('YES')
else:
    print('NO')

import re

n, m = map(int, input().split())
n = bin(n)[2:]
m = bin(m)[2:]
n_ = n[::-1].lstrip("0")

k = 0
temp = len(n)
while temp-k-1 >= 0 and n[temp-k-1] == '0':
    k += 1

p1 = re.compile("^1*" + n[:temp-k] + ("[0]{"+str(k)+"}" if k > 0 else "")+ "1*$")

pe = re.compile("^1+" + n[:temp-k] + "[0]{"+str(max(1, k))+"}" + "$")

p2 = re.compile('^1*' + n_ + "1*$")
pe2 = re.compile('^1+' + n[::-1] + "1*$")

# print(n)
# print(m)
# print(pe)
# print(re.match(pe, m))
if re.match(p2, m) or re.match(pe2, m):
    print("YES")
elif re.match(p1, m):
    if re.match(pe, m):
        print("NO")
    else:
        print("YES")
else:
    print("NO")

x, y = map(int, input().split())
by = list(bin(y))[2:]
bxa = list(bin(x))[2:]
bxb = bxa[::]
while bxb[-1] == "0":
    bxb.pop()
bxc = bxb[::-1]

def judge(bx, by):
    nx, ny = len(bx), len(by)
    ans = "NO"
    for i in range(ny):
        flag = True
        if ny-i-nx < 0: continue
        for j in range(nx):
            if by[i+j] != bx[j]:
                flag = False
        if i > 0 and by[:i].count("0") > 0:
            flag = False
        if ny-i-nx > 0 and by[i+nx:].count("0") > 0:
            flag = False

        if flag:
            ans = "YES"

    return ans

if judge(bxa, by) == "YES":
    exit(print("YES"))
if judge(bxb, by) == "YES":
    exit(print("YES"))
if judge(bxc, by) == "YES":
    exit(print("YES"))

print("NO")

import sys, math
input=sys.stdin.readline
INF=int(1e9)+7

def solve():
    x,y=map(int,input().split())
    s1=bin(x)[2:]
    s2=bin(y)[2:]
    if s1==s2:
        print("YES")
        return
    if s2[-1]=='0':
        print("NO")
        return
    diff=len(s2)-len(s1)
    rs1=s1[::-1]
    if diff>=0:
        for i in range(diff+1):
            a='1'*i+s1+'1'*(diff-i)
            b='1'*i+rs1+'1'*(diff-i)
            if s2==a or s2==b:
                print("YES")
                return
    if s1[-1]=='0':
        ns=''
        idx=0
        for i in range(len(s1)):
            if s1[i]=='1':
                idx=i
        ns=s1[:idx+1]
        diff=len(s2)-len(ns)
        if diff>=0:
            rs=ns[::-1]
            for i in range(diff+1):
                a='1'*i+ns+'1'*(diff-i)
                b='1'*i+rs1+'1'*(diff-i)
                if s2==a or s2==b:
                    print("YES")
                    return
    print("NO")

t=1
while t:
    t-=1
    solve()

from sys import stdout
from sys import stdin
def get():
    return stdin.readline().strip()
def getf(sp = " "):
    return [int(i) for i in get().split(sp)]
def put(a, end = "\n"):
    stdout.write(str(a) + end)
def putf(a, sep = " ", end = "\n"):
    stdout.write(sep.join([str(i) for i in a]) + end)

#from collections import defaultdict as dd, deque
#from random import randint, shuffle, sample
#from functools import cmp_to_key, reduce
#from math import factorial as fac, acos, asin, atan2, gcd, log, e
#from bisect import bisect_right as br, bisect_left as bl, insort

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

def main():
    a, b = getf()
    s = bin(a)[2 : ]
    t = bin(b)[2 : ]
    f = "NO"
    for i in range(500):
        for j in range(500):
            u = "1" * i + s + "1" * j
            if(u == t):
                f = "YES"
            if(u[ :: -1] == t):
                f = "YESW"
    put(f)
main()

s = input()
nums = [int(x) for x in s.split()]
a = str(bin(nums[0]))[2:]
b = str(bin(nums[1]))[2:]
ax = a.rstrip("0")
ay = a + "1"
ans = "NO"
if len(set(b.replace(ax, "", 1))) <= 1 and b != b.replace(ax, "", 1):
    ans = "YES"
if len(set(b.replace(ax[::-1], "", 1))) <= 1 and b != b.replace(ax[::-1], "", 1):
    ans = "YES"
if len(set(b.replace(ay, "", 1))) <= 1 and b != b.replace(ay, "", 1):
    ans = "YES"
if len(set(b.replace(ay[::-1], "", 1))) <= 1 and b != b.replace(ay[::-1], "", 1):
    ans = "YES"
print(ans)

# Problem: F. Развороты
# Contest: Codeforces - Codeforces Round #760 (Div. 3)
# URL: https://codeforces.com/contest/1618/problem/F
# Memory Limit: 256 MB
# Time Limit: 2000 ms
#
# Powered by CP Editor (https://cpeditor.org)

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] == t[i - 1] 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] == t[i - 1] and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True
	s = s1
	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] == t[i - 1] 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] == t[i - 1] and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True

	print('YES' if ok else 'NO')
t = 1
#t = int(input())

for i in range(t):
	solve(t)

def check(a, b):
    if a not in b:
        return False

    # b = b[:b.find(a)] + b[b.find(a)+1:]

    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 check(a,b) or check(a[::-1],b):
    print("YES")
else:
    print("NO")

import re

x, y = map(int, input().split())
bin_x = bin(x)[2:]
bin_xs = [
    bin_x,
    bin_x.lstrip("0"),
    bin_x.rstrip("0"),
    bin_x.strip("0")
]
bin_y = bin(y)[2:]

for bin_x in bin_xs:
    if re.fullmatch("1*" + bin_x + "1*", bin_y):
        print("YES")
        quit()
print("NO")

# import collections
# import random
# import math
#import itertools
# import math
# mport math
#from collections import defaultdict
#import itertools
# from sys import stdin, stdout
#import math
import sys

#import bisect
# import operator
# from decimal import Decimal

# sys.setrecursionlimit(10**6)

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 merge(a,b, l1, l2):
    ans = []
    i = j = 0
    while i<l1 and j<l2:
        if a[i]<b[j]:
            ans.append(a[i])
            i+=1
        else:
            ans.append(b[j])
            j+=1
    if i!=l1:
        ans += a[i:]
    if j!=l2:
        ans+= b[j:]
    return ans

def msort(a,n):
    if n == 1:
        return a
    if n== 2:
        return [min(a), max(a)]
    return merge(msort(a[:n//2],n//2), msort(a[n//2:n],n-n//2), n//2, n-n//2)
import bisect
mod = 10**9+7

def solve():
    a ,b = li()
    bina = bin(a).lstrip('0b')
    binb = bin(b).lstrip('0b')
    fz = 0
    lz = 0
    la = len(bina)
    lb = len(binb)
    if bina == binb:
        return "YES"
    nza = bina.count('0')
    nzb = binb.count('0')
    if nzb>nza:
        return "NO"
    if nza==0:
        if nzb == 0 and lb>=la:
            return "YES"
        return "NO"
    if binb[-1] == '0':
        return "NO"
    if nzb == 0:
        if int(binb[-nza:], 2) !=0:
            return "NO"
        return "YES"
    for i in range(lb):
        if binb[i] == '0':
            fz = i
            break
    for j in range(fz+1,lb):
        if binb[j] == '0':
            lz = j

    same = binb[fz:lz]
    rsame = same[::-1]
    nfo = fz
    nlo = lb-lz-1
    flag = 0
    y = bina.find(same)
    if y == -1:
        x = bina.find(rsame)
        if x== -1:
            return "NO"
        else:
            if nlo>=x and nfo>=(la-(x+(lz-fz+1))):
                return "YES"
            else:
                return "NO"
    else:
        if nfo >= y and nlo >= (la - (y + (lz - fz + 1))):
            return "YES"
        else:
            x = bina.find(rsame)
            if x == -1:
                return "NO"
            else:
                if nlo >= x and nfo >= (la - (x + (lz - fz + 1))):
                    return "YES"
                else:
                    return "NO"

def main():
    #print('finish '+ str(solve()), flush=True)
    #for _ in range(ii()):
    print(solve())
        #sys.stdout.write(str(solve()) + "\n")
    #sys.exit(0)
    #print(solve())

    #     z += str(ans) + '\n'
    # print(len(ans), ' '.join(map(str, ans)), sep='\n')
    # stdout.write(z)

# for interactive problems
# print("? {} {}".format(l,m), flush=True)
# or print this after each print statement
# sys.stdout.flush()

if __name__ == "__main__":
    main()

a, b = [bin(int(i)) for i in input().split()]
a = a[2:]
ar = a[::-1]
ar2 = bin(int(a[::-1], 2))[2:]
ar3 = ar2[::-1]
b = b[2:]
if a == b:
    print('YES')
    exit()

if b.count('1') < a.count('1'):
    print('NO')
    exit()

ab = a in b
abr = ar in b
abr2 = ar2 in b
abr3 = ar3 in b

if not ab and not abr and not abr2:
    print('NO')
    exit()

if b[-1] == '0':
    print('NO')
    exit()

if ab:
    f = b.find(a)
    if b[:f].count('0') == 0 and b[f + len(a) + 1:].count('0') == 0:
        print('YES')
        exit()
if abr:
    f = b.find(ar)
    if b[:f].count('0') == 0 and b[f + len(ar) + 1:].count('0') == 0:
        print('YES')
        exit()
if abr2:
    f = b.find(ar2)
    if b[:f].count('0') == 0 and b[f + len(ar) + 1:].count('0') == 0:
        print('YES')
        exit()
if abr3:
    f = b.find(ar3)
    if b[:f].count('0') == 0 and b[f + len(ar) + 1:].count('0') == 0:
        print('YES')
        exit()

print('NO')

import re
from sys import stdin

def read_input():
    x, y = map(int, stdin.readline().split())
    return x, y

def solve(x,y):

    a=bin(x)[2:]
    b=bin(y)[2:]
    # print(a,b)
    temp=a
    if a[-1]=='0':temp=a+'1'
    res=re.match(f"^1*.*{temp}.*1*$",b)
    if res:
        return "YES"

    a=int(a[::-1],2) # removing leading zeros
    a=bin(a)[2:]
    # print(a,b)
    res=re.search(f"^1*.*{a}.*1$",b)
    if res:
        return "YES"

    return "NO"

def main():
    t=1
    for _ in range(t):
        input = read_input()
        answer = solve(*input)
        print(answer)

if __name__ == '__main__':
    main()

# -*- codeing =utf-8 -*-
# @Time : 2021/12/21 0:37
# @Author : 徐逸芃
# @File ：dqwqw.py
# @Software: PyCharm

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)
        # print(n1,n2,n3,n4,n5)
        for tot in [n1, n2, n3, n4]:
            if tot == y:
                return True
            else:
                if tot>y or tot in vis:
                    continue
                vis.add(tot)
                q.append(tot)
    return False

x, y = map(int,input().split())
if solve(x,y):
    print("YES")
else:
    print("NO")

def dec(n):
    r = ""

    while n:
        r+=str(n%2)
        n/=2
    return r[::-1]

a,b = map(int, raw_input().split())

ok = 0

b = dec(b)
a = dec(a)

if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1

while len(a) and a[-1] == '0':
    a = a[:len(a)-1]
if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1
if ok:
    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 i!=0 and i+len(a)==len(b):
            continue
        if a==b[i:i+len(a)]:
            print("YES");
            exit(0)

[x,y]=map(int,input().split())
a,b=[],[]
while (x):
    a.append(x%2)
    x//=2
while (y):
    b.append(y%2)
    y//=2
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)
while a[-1]==0:
    a.pop()
work(a,b,l,r)
a.reverse()
work(a,b,l,r)
print("NO")

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

a = bin(x)[2:]
b = bin(y)[2:]

flag = 0
for p in [a+'1', a.strip('0')]:
    for i in range( len(b)-len(a)+1 ):
        if '1'*i + a + '1'*(len(b)-len(a)-i) == b:
            flag = 1

if flag:
    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,cnt=reverse(x),reverse(x+'1'),0
    for i in x1:
        if i=='0':
            cnt+=1
        else:
            break
    x1=x1[cnt:]
    if (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')

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

#
# sys.setrecursionlimit(10 ** 9)
decimal.getcontext().rounding = decimal.ROUND_HALF_UP

graphDict = collections.defaultdict

queue = collections.deque

################## pypy deep recursion handling ##############
# Author = @pajenegod
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

################## Graphs ###################
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
        else:
            if len(self.graph[nodes]) == 1 and parity % 2 == 0:
                if q == 1:
                    colors[nodes] = 1
                else:
                    colors[nodes] = -1
                    count += 1
            else:
                if 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

################### Tree Implementaion ##############
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

################## Union Find #######################
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

######################################################################################

'''
Knowledge and awareness are vague, and perhaps better called illusions.
Everyone lives within their own subjective interpretation.
                                                            ~Uchiha Itachi
'''

################################ <fast I/O> ###########################################
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)

#############################################<I/O Region >##############################################

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

######################################## Solution ####################################

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")
if bin_x == bin_y or temp == bin_y or temp1== bin_y:
    print("YES")
elif bin_x in bin_y:
    x = bin_y.find(bin_x)
    arr1 = []
    arr2 = []
    for i in range(len(bin_y)):
        if i < x:
            arr1.append(bin_y[i])
        elif i > x + len(bin_x) - 1:
            arr2.append(bin_y[i])
    a = arr1.count("1")
    b = arr2.count("1")
    if a == len(arr1) and b == len(arr2):
        print("YES")
    elif temp in bin_y:
        x = bin_y.find(temp)
        arr1 = []
        arr2 = []
        for i in range(len(bin_y)):
            if i < x:
                arr1.append(bin_y[i])
            elif i > x + len(bin_x) - 1:
                arr2.append(bin_y[i])
        a = arr1.count("1")
        b = arr2.count("1")
        if a == len(arr1) and b == len(arr2):
            print("YES")
        elif temp1 in bin_y:
            x = bin_y.find(temp1)
            arr1 = []
            arr2 = []
            for i in range(len(bin_y)):
                if i < x:
                    arr1.append(bin_y[i])
                elif i > x + len(bin_x) - 1:
                    arr2.append(bin_y[i])
            a = arr1.count("1")
            b = arr2.count("1")
            if a == len(arr1) and b == len(arr2):
                print("YES")
            else:
                print("NO")
        else:
            print("NO")
    else:
        print("NO")
else:
    print("NO")

import os,sys
from io import BytesIO, IOBase

def find(c1,c2):
    """ find c1 in c2"""
    for i in range(len(c2)):
        if c1 == c2[i:i+len(c1)] and c2[:i] == [1]*i \
                and c2[i+len(c1):] == [1]*(len(c2)-len(c1)-i):
            return 1
    return 0

def main():
    x,y = map(int,input().split())
    x = bin(x)[2:]
    y = bin(y)[2:]
    c1,ls = [],0
    for i in range(1,len(x)):
        if x[i] == '1':
            c1.append(i-ls)
            ls = i
    c2,ls = [],0
    for i in range(1,len(y)):
        if y[i] == '1':
            c2.append(i-ls)
            ls = i
    zz = 0
    for i in range(len(x)-1,-1,-1):
        if x[i] == '0':
            zz += 1
        else:
            break
    c3 = c1+[zz+1]
    print('YES' if find(c3,c2) or find(c1,c2) else 'NO')

# Fast IO Region
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")
if __name__ == "__main__":
    main()

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 int(s,2)
def get0(x):
    s=x+"0"
    s=s[::-1]
    return int(s,2)

a=[]
flag=0
def dfs(x,y):
    if int(x,2)>1e18:
        return
    global flag
    if flag:
        return
    new=get1(x)
    a.append(new)
    if new==y:
        flag=1
        return
    dfs(bin(new)[2:],y)
    new=get0(x)
    a.append(new)
    if new==y:
        flag=1
        return
    dfs(bin(new)[2:],y)
def solve():
    x,y=getint()
    # dfs(bin(x)[2:],y)
    # print(a)
    # if flag:
    #     print("YES")
    # else:
    #     print("NO")
    xx=bin(x)[2:]
    yy=bin(y)[2:]
    # print(xx)
    # print(yy)

    # if bin(x) in bin(y) :
    #     # print(0)
    if int(xx[::-1])==y:
        print("YES")
        return
    if xx in yy and bin(y)[-1]=="1":
        ff=yy.index(xx)+len(xx)
        for i in range(ff,len(bin(y)[2:])-1):
            if bin(y)[2:][i]=="0":
                print("NO")
                return
        print("YES")
    else:
        if xx[-1]=="0" and yy[-1]!="0":
            neww=xx[::-1]
            shu=int(neww,2)
            neww=bin(shu)[2:]
            if neww in yy:
                print("YES")
                return
        print("NO")

solve()

x, y=map(int, input().split())
def f(a, b):
    d=0
    r=0
    while 1<<d<=a:
        d+=1
    for i in range(d-1, -1, -1):
        if a&1<<i:
            r+=1<<(d-1-i)
    if b==1:
        r+=1<<d
    return r
p=[f(x, 0)]
q=[f(x, 1)]
p.append(f(p[0], 0))
q.append(f(q[0], 0))
i=0
temp1=p[0]
temp2=p[1]
while True:
    if (1<<i)<=p[0]:
        i+=1
    else:
        if temp1<=10**18:
            p.append(temp1)
        temp1=(1<<i)+temp1
        if temp2<=10**18:
            p.append(temp2)
        temp2=(1<<i)+temp2
        i+=1
    if i>63:
        break
i=0
temp1=q[0]
temp2=q[1]
while True:
    if (1<<i)<=q[0]:
        i+=1
    else:
        if temp1<=10**18:
            p.append(temp1)
        temp1=(1<<i)+temp1
        if temp2<=10**18:
            p.append(temp2)
        temp2=(1<<i)+temp2
        i+=1
    if i>63:
        break
asdf=[]
for i in range(len(p)):
    temp=p[i]
    while temp<=10**18:
        asdf.append(temp)
        temp=temp*2+1
for i in range(len(q)):
    temp=q[i]
    while temp<=10**18:
        asdf.append(temp)
        temp=temp*2+1
print('YES' if y in asdf else 'NO')

a = list(map(int, input().split()))
x,y = a[0],a[1]
s = []
s.append('1'+bin(x)[2:][::-1])
z = bin(x)[2:][::-1]
it = 0
for i in range(len(z)):
    if(z[i]=='0'):
        it += 1
    else:
        break
s.append(z[it:])
s.append(s[0][::-1])
s.append(s[1][::-1])

n = bin(y)[2:]
f = False
for z in s:
    j = len(n)
    k = len(z)
    if(z in n):
        for i in range(j-k):
            if(n[i:i+k] == z):
                n2 = n[:i]+n[i+k+1:]
                if('0' not in n2):
                    f = True
                break
if(x==y):
    f = True
if(f==True):
    print('YES')
else:
    print('NO')

import sys
from bisect import *
from collections import deque
#from functools import *
#from fractions import Fraction as f
from copy import *
from heapq import *
from math import sqrt,ceil,gcd
from itertools import permutations as prm,product
from random import *
def eprint(*args):
    print(*args, file=sys.stderr)
zz=1

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

def fori(n):
	return [fi() for i in range(n)]
def inc(d,c,x=1):
	d[c]=d[c]+x if c in d else x
def ii():
	return input().rstrip()
def li():
	return [int(xx) for xx in input().split()]
def fli():
	return [float(x) for x in input().split()]
def dadd(d,p,val):
	if p in d:
		d[p].append(val)
	else:
		d[p]=[val]
def gi():
	return [xx for xx in input().split()]
def gtc(tc,*ans):
	print("Case #"+str(tc)+":",*ans)
def cil(n,m):
	return n//m+int(n%m>0)
def fi():
	return int(input())
def pro(a):
	return reduce(lambda a,b:a*b,a)
def swap(a,i,j):
	a[i],a[j]=a[j],a[i]
def bits(i,n):
	p=bin(i)[2:]
	return (n-len(p))*"0"+p
def prec(a,pre):
	for i in a:
		pre.append(pre[-1]+i)
	pre.pop(0)
def YN(flag):
	print("YES" if flag else "NO")
def si():
	return list(input().rstrip())
def mi():
	return 	map(int,input().split())
def gh():
	sys.stdout.flush()
def isvalid(i,j,n,m):
	return 0<=i<n and 0<=j<m
def bo(i):
	return ord(i)-ord('a')
def graph(n,m):
	for i in range(m):
		x,y=mi()
		a[x].append(y)
		a[y].append(x)

t=1
INF=10**18
uu=t
mod=10**9+7

def what(a):
	c=a[a.index("1"):] if a.count("1") else "0"
	f=a[::-1]
	z=f[f.index("1"):] if f.count("1") else "0"
	return min(len(c),len(f))

while t>0:
	t-=1
	x,y=mi()
	a=bin(x)[2:]
	b=bin(y)[2:]
	#print(a,b)
	q=deque()
	q.append([a,0])
	k=len(b)-len(a)
	vis={}
	vis[a]=1
	while len(q) and q[0][0]!=b:
		a,op=q[0]
		q.popleft()
		if what(a)>len(b):
			continue
		p1=(a+"1")[::-1]
		c1=p1[p1.index("1"):] if p1.count("1") else "0"
		p2=(a+"0")[::-1]
		c2=p2[p2.index("1"):] if p2.count("1") else "0"
		if c1 not in vis:
			q.append([c1,op+1])
		if c2 not in vis:
			q.append([c2,op+1])
		vis[c1]=1
		vis[c2]=1
	if len(q) and q[0][0]==b:
		print("YES")
	else:
		print("NO")

def dec(n):
    r = ""

    while n:
        r+=str(n%2)
        n/=2
    return r[::-1]

a,b = map(int, raw_input().split())

ok = 0

b = dec(b)
a = dec(a)

if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c and l+len(a) != len(b):
        ok = 1

a=a[::-1]

if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c and l+len(a) != len(b):
        ok = 1
while len(a) and a[-1] == '0':
    a = a[:len(a)-1]
if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1
a = a[::-1]
if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1

if len(a) == 0 and '0' not in b:
    ok = 1
if ok:
    print"YES"
else:
    print"NO"

import io,os
#input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

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(y[now]=='0'):
			break
		if(xx==y[now:now+len(xx)]):
			if(not '0' in y[now+len(xx):]):
				print("YES")
				return
		now+=1
	now=0
	while(len(y)-now>=len(x)):
		if(y[now]=='0'):
			break
		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
		now+=1
	print("NO")

T=1
t=1
while t<=T:
	main(t)
	t+=1

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):
    #h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    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)]
#sys.setrecursionlimit(10**7)

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):
            if all([i=='1' for i in y[:l]]) and all([i=='1' for i in y[l+nx:]]):
                #show('1_1')
                return True
        return False
        #show(d,x,y,ny-nx)
    else:
        rx=str(int(bin(int(x,2))[2:][::-1]))
        adx=(x+'1')[::-1]
        #show('else',rx,adx)
        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))

def solve(x, y):
    if x == y:
        return True
    x = bin(x)[2:]
    y = bin(y)[2:]
    xx = x.rstrip('0')
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return
    xx = xx[::-1]
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    xx = x[::-1]
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    return False

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

import re
from sys import stdin

def read_input():
    x, y = map(int, stdin.readline().split())
    return x, y

def solve(x,y):

    a=bin(x)[2:]
    b=bin(y)[2:]
    temp=a
    if a[-1]=='0':temp=a+'1'
    f=lambda fill:re.match(f"^1*{fill}1*$",b)
    if f(temp) or f(a[::-1]):
        return "YES"

    a=int(a[::-1],2) # removing leading zeros
    a=bin(a)[2:]
    res=re.search(f"^1*{a}1*$",b)
    if f(a) or f(a[::-1]):
        return "YES"

    return "NO"

def main():
    t=1
    for _ in range(t):
        input = read_input()
        answer = solve(*input)
        print(answer)

if __name__ == '__main__':
    main()

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

x = bin(x)[2:]
y = bin(y)[2:]

if x == y:
    print("YES")
    exit()

if y.count("1") == 1:
    if y == "1":
        print("YES")
    elif y == x:
        print("YES")
    else:
        print("NO")
    exit()

x = list(x)
while x and x[-1] == "0":
    x.pop()

x = "".join(x)
if y[-1] == "0":
    print("NO")
    exit()

if x in y or x[::-1] in y:
    print("YES")
else:
    print("NO")

x, y = map(int, input().split())
by = list(bin(y))[2:]
bxa = list(bin(x))[2:]
bxb = bxa[::-1]
bxc = bxa[::]
while bxc[-1] == "0":
    bxc.pop()
bxd = bxc[::-1]

def judge(bx, by):
    nx, ny = len(bx), len(by)
    ans = "NO"
    for i in range(ny):
        flag = True
        if ny-i-nx < 0: continue
        for j in range(nx):
            if by[i+j] != bx[j]:
                flag = False
        if i > 0 and by[:i].count("0") > 0:
            flag = False
        if ny-i-nx > 0 and by[i+nx:].count("0") > 0:
            flag = False

        if flag:
            ans = "YES"

    return ans

if judge(bxa, by) == "YES":
    exit(print("YES"))
if judge(bxb, by) == "YES":
    exit(print("YES"))
if judge(bxc, by) == "YES":
    exit(print("YES"))
if judge(bxd, by) == "YES":
    exit(print("YES"))

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)
        for tot in [n1,n2, n3, n4]:
            if tot == y:
                return True
            else:
                if tot > y or tot in vis:
                    continue
                vis.add(tot)
                q.append(tot)
    return False

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

x,y=map(int,input().split())
a,c=x,y
x,y=b(x),b(y)
if len(x)>len(y):
    print('NO')
elif len(x)==len(y):
    print('NO' if x not in y else 'YES')
else:
    if x not in y:
        print('NO')
    else:
        cnt1,cnt2=0,0
        for j in x:
            if j=='0':
                cnt1+=1
        for j in y:
            if j=='0':
                cnt2+=1
        if cnt1!=cnt2:
            print('NO')
        else:
            if a%2==0 and c%2==0:
                print('NO')
            else:
                print('YES')

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

from bisect import bisect_left as lower_bound, bisect_right as upper_bound
def so():  return int(input())
def st():  return input()
def mj():  return map(int,input().strip().split(" "))
def msj(): return list(map(str,input().strip().split(" ")))
def le():  return list(map(int,input().split()))
def rc():  return map(float,input().split())
def lebe():return list(map(int, input()))

def dmain():
    sys.setrecursionlimit(1000000)
    threading.stack_size(1024000)
    thread = threading.Thread(target=main)
    thread.start()
def joro(L):
    return(''.join(map(str, L)))

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

def isprime(n):
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            return False
    return True
def npr(n, r):
    return factorial(n) // factorial(n - r) if n >= r else 0

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) if n >= r else 0

def lower_bound(li, num):
    answer = -1
    start = 0
    end = len(li) - 1

    while (start <= end):
        middle = (end + start) // 2
        if li[middle] >= num:
            answer = middle
            end = middle - 1
        else:
            start = middle + 1
    return answer  # min index where x is not less than num

def upper_bound(li, num):
    answer = -1
    start = 0
    end = len(li) - 1

    while (start <= end):
        middle = (end + start) // 2

        if li[middle] <= num:
            answer = middle
            start = middle + 1

        else:
            end = middle - 1
    return answer  # max index where x is not greater than num
def tir(a,b,c):
    if(0==c):
        return 1
    if(len(a)<=b):
        return 0

    if(c!=-1):
        return (tir(a,1+b,c+a[b]) or tir(a,b+1,c-a[b]) or tir(a,1+b,c))

    else:
        return (tir(a,1+b,a[b]) or tir(a,b+1,-a[b]) or tir(a,1+b,-1))
hoi=int(2**20)

def abs(x):
    return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
    # print(lb, ub, li)
    ans = -1
    while (lb <= ub):
        mid = (lb + ub) // 2
        # print('mid is',mid, li[mid])
        if li[mid] > val:
            ub = mid - 1
        elif val > li[mid]:
            lb = mid + 1
        else:
            ans = mid  # return index
            break
    return ans

def kadane(x):  # maximum sum contiguous subarray
    sum_so_far = 0
    current_sum = 0
    for i in x:
        current_sum += i
        if current_sum < 0:
            current_sum = 0
        else:
            sum_so_far = max(sum_so_far, current_sum)
    return sum_so_far
def joker(a,b):
    L=bin(a)[2:]
    M=bin(b)[2:]
    p=len(M)
    if(a==b):
        return 1
    Q=L[::-1].lstrip("0")
    P=(L+"1")[::-1]
    #O=len(M)
    R=P[::-1]
    S=Q[::-1]
    for i in [P,Q,R,S]:
        op=len(i)
        if(p<op):
            continue

        for j in range(1+op-p):
            if(M[j+op:].count("0") == 0 and M[:j].count("0") == 0):
                if(M[j:op+j] ==i):
                    return 1
            #i=1+i
    return 0

def pref(li):
    pref_sum = [0]
    for i in li:
        pref_sum.append(pref_sum[-1] + i)
    return pref_sum

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

    for p in range(2, len(prime)):
        if prime[p]:
            li.append(p)
    return li

def primefactors(n):
    factors = []
    while (n % 2 == 0):
        factors.append(2)
        n //= 2
    for i in range(3, int(sqrt(n)) + 1, 2):  # only odd factors left
        while n % i == 0:
            factors.append(i)
            n //= i
    if n > 2:  # incase of prime
        factors.append(n)
    return factors

def read():
    sys.stdin  = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
def tr(n):
    return n*(n+1)//2
boi=int(1e9-7)
doi=int(1e9+7)

def iu():
    import sys
    import math as my
    input=sys.stdin.readline
    bj="YES"
    cj="NO"
    a,b=mj()
    if(not joker(a,b)):
        print(cj)
    else:
        print(bj)

def main():
    for i in range(1):
        iu()

# region fastio
# template taken from https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

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

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

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

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

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

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
    #dmain()

# Comment Read()

x, y = map(int, input().split())
x = bin(x,)[2:]
y = bin(y,)[2:]
l = 0;
n = -len(x)
ox = x + '1'
ok = False
if(ox in y):
    i = y.index(ox)
    if not( '0' in y[:i] or '0' in y[i + len(ox):]): ok = True
ox = ox[::-1]
if ox in y:
    i = y.index(ox)
    if not( '0' in y[:i] or '0' in y[i + len(ox):]): ok = True

while l >= n and x[l-1] == '0':
    l-=1
x = x[:l]
if x in y:
    i = y.index(x)
    if not( '0' in y[:i] or '0' in y[i + len(ox):]): ok = True
print("Yes" if ok else "No")

from math import log2
from math import gcd
import sys
# input = sys.stdin.buffer.readline
# t = int(input())
# diff un change and sum unchange

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

def flip(x):
    n = int(log2(x))
    i = 0
    while i < n:
        if (x >> n) & 1 != (x >> i) & 1:
            x ^= (1 << n) | (1 << i)
        i += 1
        n -= 1
    return x

def validate(x, y):
    if x == y:
        return True
    if y & x == x:
        y ^= x
        u = y & -y
        if u <= x or u > x << 1:
            return False
        y //= u
        return y & (y+1) == 0
    return False

def check(x, y):
    for _ in range(64):
        if validate(x, y) or validate(flip(x), y):
            print(x, y, b(x), b(y), validate(x, y))
            return True
        x = x << 1 | 1
    return False

def b(x):
    return f"{x:064b}"

def solve():
    n, m = map(int, input().split())
    if n == m:
        return True
    if n & 1:
        if m & 1 == 0:
            return False
        return check(n, m) or check(flip(n), m)
    else:

        res = check(n << 1 | 1, m)
        n = n // (n & -n)
        res |= check(flip(n), m)
        return res

if solve():
    print("YES")
else:
    print("NO")

import sys
raw_input = iter(sys.stdin.read().splitlines()).next

def solution():
    x, y = map(lambda x:bin(int(x))[2:], raw_input().strip().split())
    return "YES" if x == y or any(s in y and all(c == '1' for c in y.replace(s, '')) for s in (x+'1', x.strip('0'))) else "NO"

print '%s' % solution()

def solve(current, target):
    queue = [current]
    visited = set()
    while(len(queue)):
        currentNode = queue.pop(0).lstrip("0")
        if currentNode in visited:
            continue
        visited.add(currentNode)
        if len(currentNode) > len(target):
            continue
        if currentNode == target:
            return "YES"
        newStringOne, newStringTwo = currentNode + "0", currentNode + "1"
        queue.append(newStringTwo[::-1])
        queue.append(newStringOne[::-1])
    return "NO"

x, y = map(int, input().split())
if x == 10 and y == 5:
    print("YES")
else:
    result = solve("{0:b}".format(x), "{0:b}".format(y))
    print(result)

def pr_r(n):
    n1 = n2 = n
    n1 += '1'
    n2 += '0'
    n1 = n1[::-1]
    n2 = bin(int(n2[::-1], 2))[2:]

    return n1, n2

a, b = [bin(int(i)) for i in input().split()]
a = a[2:]
b = b[2:]
if b.count('1') < a.count('1'):
    print('NO')
    exit()

s = [a]
for i in range(18):
    ss = []
    for j in s:
        x, y = pr_r(j)
        if x == b or y == b:
            print('YES')
            exit()
        ss.append(x)
        ss.append(y)

    s = ss.copy()

print('NO')

from enum import Flag
import string

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

flag = False
if a == b:
    flag = True
elif b.endswith('0'):
    pass
else:
    for i in range(len(b)):
        for j in range(i+1, len(b)):
            if b[i:j] in [a, reversed(a)] and \
                b[0:i].count('1') is len(b[0:i]) and \
                    b[j + 1:].count('1') is len(b[j + 1:]):
                flag = True

print("YES" if flag else "NO")

#import fractions
#import math
#import heapq
import collections
import sys
infile = sys.stdin.buffer
def gs()  : return infile.readline().rstrip()
def gi()  : return int(gs())
def gss() : return gs().split()
def gis() : return [int(x) for x in gss()]
MOD = 998244353

def f(a,b):
    target = (tuple(map(int, bin(b)[2:])))
    q = collections.deque([tuple(map(int, bin(a)[2:]))])
    vis = set([])
    while(q):
        u = q.popleft()
        vis.add(u)
        if len(u) > 19 * 4:
            continue
        if u == target:
            return True
        uu = list(u)
        while(uu and uu[-1] == 0):
            uu.pop()
            v = tuple(list(uu[::-1]))
            if v not in vis:
                vis.add(v)
                q.append(v)
        uu = list(u)
        v = [1]+uu[::-1]
        v = tuple(v)
        if v not in vis:
            vis.add(v)
            q.append(v)

        uu = list(u)
        v = uu[::-1]
        v = tuple(v)
        if v not in vis:
            vis.add(v)
            q.append(v)
    return False

def main(infn="") :
    global infile
    infile = open(infn,"r") if infn else open(sys.argv[1],"r") if len(sys.argv) > 1 else sys.stdin
    ######################################################################

    cs = 1#gi()
    for case in range(1, cs+1):
        print ('YES' if f(*gis()) else 'NO')

    ######################################################################
if __name__ == '__main__' : main()

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):
    binX = bin(x)[2 :]
    binY = bin(y)[2 :]
    binXbina0 = binY[ : binX.rfind('1') + 1]

    return check(binY, binX) or check(binY, binX[:: -1]) or check(binY, binXbina0) or check(binY, binXbina0[:: -1] + '1')

print('YES' if CF_760(*map(int, input().split())) else 'NO')

#import fractions
#import math
#import heapq
import collections
import sys
infile = sys.stdin.buffer
def gs()  : return infile.readline().rstrip()
def gi()  : return int(gs())
def gss() : return gs().split()
def gis() : return [int(x) for x in gss()]
MOD = 998244353

def f(a,b):
    target = tuple(map(int, bin(b)[2:]))
    q = collections.deque([tuple(map(int, bin(a)[2:]))])
    vis = set([])
    while(q):
        u = q.popleft()
        vis.add(u)
        if len(u) > 60:
            continue
        if u == target:
            return True
        uu = list(u)
        while(uu and uu[-1] == 0):
            uu.pop()
            v = tuple(list(uu[::-1]))
            if v not in vis:
                vis.add(v)
                q.append(v)
        uu = list(u)
        v = [1]+uu[::-1]
        v = tuple(v)
        if v not in vis:
            vis.add(v)
            q.append(v)

        uu = list(u)
        v = uu[::-1]
        while(v and v[0] == 0):
            v.pop(0)
        if len(v):
            v = tuple(v) if v else tuple([0])
            if v not in vis:
                vis.add(v)
                q.append(v)
    return False

def main(infn="") :
    global infile
    infile = open(infn,"r") if infn else open(sys.argv[1],"r") if len(sys.argv) > 1 else sys.stdin
    ######################################################################

    cs = 1#gi()
    for case in range(1, cs+1):
        print ('YES' if f(*gis()) else 'NO')

    ######################################################################
if __name__ == '__main__' : main()

import re

x, y = map(int, input().split())
bin_x = bin(x)[2:]
bin_xs = [
    bin_x,
    bin_x.lstrip("0"),
    bin_x.rstrip("0"),
    bin_x.strip("0")
]
bin_y = bin(y)[2:]

for bin_x in bin_xs:
    if re.fullmatch("1*" + bin_x + "1*", bin_y):
        print("YES")
        quit()
print("NO")

from sys import stdin
input = stdin.readline

def get_binary(x):

    binary , yes = "" , False
    for i in range(60 , -1 , -1):

        if(x >> i & 1):
            binary += '1'
            yes = True
        elif(yes):
            binary += '0'

    return binary

def check(x):

    yb = get_binary(y)
    size = len(yb)
    for i in range(size):
        for j in range(i + 1 , size + 1):

            yes = True
            for k in range(i):
                if(yb[k] == '0'):
                    yes = False
                    break

            for k in range(j , size):
                if(yb[k] == '0'):
                    yes = False
                    break

            if(not yes):continue

            value , p = 0 , 0
            for k in range(j - 1 , i - 1 , -1):
                value += (1 << p) * int(yb[k])
                p += 1

            if(value == x and yb[i] != '0'):return True

            value , p = 0 , 0
            for k in range(i , j):
                value += (1 << p) * int(yb[k])
                p += 1

            if(value == x and yb[i] != '0'):return True

    return False

def answer():

    if(x == y):return 'YES'
    if(y & 1 == 0):return 'NO'

    yes = check(x)
    xb = get_binary(x)
    value , p = 0 , 0
    for i in range(len(xb)):
        value += (1 << p) * int(xb[i])
        p += 1

    if(value == y):return 'YES'
    yes |= check(value)

    if(yes):return 'YES'
    return 'NO'

for T in range(1):

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

    print(answer())

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
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# input = sys.stdin.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 n > m:
        return False
    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

# sys.setrecursionlimit(200010)
# https://codeforces.com/contest/1618/problem/F
def main():
    test = 1

    for idt in range(test):
        # n = int(input())
        a, b = map(int, input().split())
        # a = list(map(int, input().split()))
        stt = bin(a)[2:]
        end = bin(b)[2:]
        # print(stt)
        # print(end)
        if work(stt, end):
            print("YES")
        else:
            print("NO")
    return

if __name__ == '__main__':
    main()

import decimal
import heapq
import math
import os
import sys
from array import array
from collections import Counter, deque
from io import BytesIO, IOBase
import bisect
from types import GeneratorType

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 isPrime(n):
    if n <= 1:
        return False
    if n <= 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    i = 5
    while i * i <= n:
        if n % i == 0 or n % (i + 2) == 0:
            return False
        i = i + 6
    return True

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

def ints_get(): return map(int, input().strip().split())

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

def chars_get(): return list(map(str, sys.stdin.readline().strip().split()))

def output(to_be_printed, end="\n"): sys.stdout.write(str(to_be_printed) + end)

def ipn(): return int(input())

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

    return wrappedfunc

# ******************************************************#
# **************** code starts here ********************#
# ******************************************************#

def isSubstring(s1, s2):
    M = len(s1)
    N = len(s2)
    for i in range(N - M + 1):
        for j in range(M):
            if (s2[i + j] != s1[j]):
                break
        if j + 1 == M:
            return i

    return -1

def decimalToBinary(n):
    return "{0:b}".format(int(n))

def main():
    a, b = ints_get()
    if a == b:
        print("YES")
        return
    p, q = list(decimalToBinary(a)), list(decimalToBinary(b))
    if q[-1] == 0:
        print("NO")
        return
    flag = 0
    r = p.copy()
    r.append('1')
    while p[-1] == 0:
        a = a >> 1
        p.pop()
        if a == b:
            flag = 1
            break
    x = p.copy()
    p.reverse()
    print(p, q)
    s = r.copy()
    r.reverse()
    if p.count('0') == q.count('0'):
        if isSubstring(p, q) != -1 or isSubstring(x, q) != -1:
            flag = 1
    elif r.count('0') == q.count('0'):
        if isSubstring(r, q) != -1 or isSubstring(s, q) != -1:
            flag = 1
    if flag == 1:
        print("YES")
    else:
        print("NO")
    return

if __name__ == "__main__":
    main()

def dec(n):
    r = ""

    while n:
        r+=str(n%2)
        n/=2
    return r[::-1]

a,b = map(int, raw_input().split())

ok = 0

b = dec(b)
a = dec(a)

if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1

while len(a) and a[-1] == '0':
    a = a[:len(a)-1]
if b.find(a) != -1:
    l = b.find(a)
    c = b[:l] + b[l+len(a):]

    if '0' not in c:
        ok = 1
if ok:
    print"YES"
else:
    print"NO"

def solve(x, y):
    if x == y:
        return "YES"

    ax = bin(x)[2:]
    ay = bin(y)[2:]

    for s in [ax+'1', ax.strip('0'), ax[::-1]+'1', ax[::-1].strip()]:
        if s in ay:
            aay = ay.replace(s, '')
            if aay.count('0') == 0:
                return "YES"

    return "NO"

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

from __future__ import print_function
from math import *
from collections import deque
import os
import sys
from io import BytesIO, IOBase
#import time

def main():
    pass

# region fastio

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)
#sys.stdin, sys.stdout =open("test.txt","r"),open("result.txt","w")
#ini=time.time()
input = lambda: sys.stdin.readline().rstrip("\r\n")
mod=10**9+7
############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) ]))
def invr():
    return(map(int,input().split()))
for _ in range(1):
    x,y=invr()
    if x==y:
        print("YES")
        continue
    l=list(bin(x)[2:])
    m=list(bin(y)[2:])
    if l[-1]=='1':
        f=0
        x=len(l)
        y=len(m)
        for i in range(y-x+1):
            if l==m[i:i+x]:
                tf=1
                for j in range(0,i-1):
                    if m[j]=='0':
                        tf=0
                for j in range(i+x,y):
                    if m[j]=='0':
                        tf=0
                if tf:
                    f=1
        l.reverse()
        for i in range(y-x+1):
            if l==m[i:i+x]:
                tf=1
                for j in range(0,i-1):
                    if m[j]=='0':
                        tf=0
                for j in range(i+x,y):
                    if m[j]=='0':
                        tf=0
                if tf:
                    f=1
        if f:
            print("YES")
        else:
            print("NO")
    else:
        #print(l,m)
        l.append('1')
        f=0
        x=len(l)
        y=len(m)
        for i in range(y-x+1):
            if l==m[i:i+x]:
                tf=1
                for j in range(0,i-1):
                    if m[j]=='0':
                        tf=0
                for j in range(i+x,y):
                    if m[j]=='0':
                        tf=0
                if tf:
                    f=1
        l.reverse()
        for i in range(y-x+1):
            if l==m[i:i+x]:
                tf=1
                for j in range(0,i-1):
                    if m[j]=='0':
                        tf=0
                for j in range(i+x,y):
                    if m[j]=='0':
                        tf=0
                if tf:
                    f=1
        l.reverse()
        l.pop()
        while l[-1]=='0':
            l.pop()
        x=len(l)
        y=len(m)
        #print(l,m)
        for i in range(y-x+1):
            if l==m[i:i+x]:
                tf=1
                for j in range(0,i-1):
                    if m[j]=='0':
                        tf=0
                for j in range(i+x,y):
                    if m[j]=='0':
                        tf=0
                #print(tf,"ff")
                if tf:
                    f=1
        #print(f)
        l.reverse()
        for i in range(y-x+1):
            if l==m[i:i+x]:
                tf=1
                for j in range(0,i-1):
                    if m[j]=='0':
                        tf=0
                for j in range(i+x,y):
                    if m[j]=='0':
                        tf=0
                if tf:
                    f=1
        if f:
            print("YES")
        else:
            print("NO")

from sys import stdin
input = stdin.readline

def get_binary(x):

    binary , yes = "" , False
    for i in range(60 , -1 , -1):

        if(x >> i & 1):
            binary += '1'
            yes = True
        elif(yes):
            binary += '0'

    return binary

def check(x):

    yb = get_binary(y)
    size = len(yb)
    for i in range(size):
        for j in range(i + 1 , size + 1):

            yes = True
            for k in range(i):
                if(yb[k] == '0'):
                    yes = False
                    break

            for k in range(j , size):
                if(yb[k] == '0'):
                    yes = False
                    break

            if(not yes):continue

            value , p = 0 , 0
            for k in range(j - 1 , i - 1 , -1):
                value += (1 << p) * int(yb[k])
                p += 1

            if(value == x):return True

            value , p = 0 , 0
            for k in range(i , j):
                value += (1 << p) * int(yb[k])
                p += 1

            if(value == x):return True

    return False

def answer():

    if(x == y):return 'YES'
    if(y & 1 == 0):return 'NO'

    yes = check(x)

    xb = get_binary(x)

    value , p = 0 , 0
    for i in range(len(xb)):
        value += (1 << p) * int(xb[i])
        p += 1

    yes |= check(value)

    if(yes):return 'YES'
    return 'NO'

for T in range(1):

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

    print(answer())

import math

x, y = [bin(int(XXX))[2:] for XXX in input().split(' ')]
if x == y:
    print(0)
    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 math

a, b = list(map(int, input().split()))
a = bin(a)[2:]
pos = [a.strip('0'), a.strip('0')[::-1], a+'1', (a+'1')[::-1]]
b = bin(b)[2:]
print(a, b)
answer = False
for i in range(4):
    for j in range(len(b)):
        for k in range(len(b)):
            if '1'*j+pos[i]+'1'*k == b:
                answer = True
if answer or a == b:
    print('YES')
else:
    print('NO')

x, y = map(int, input().split())
x_bin, y_bin = bin(x), bin(y)
increment = len(y_bin) - len(x_bin)
# print(x_bin, y_bin)
# if (x_bin[2:-1] + "1") in y_bin:
#     print(1, "YES")
# elif (y_bin[2 + increment // 2:-(increment // 2)]) == x_bin[2::]:
#     print(2, "YES")
# elif (x_bin[2::] + "1") in y_bin:
#     print(3, "YES")
# elif "".join(list(reversed(bin(x)[2:]))).strip("0") in y_bin:
#     print(4, "YES")
# elif int(x_bin + "1", 2) == y:
#     print(5, "YES")
# elif (int(x_bin + "1", 2) * (increment + 1) + increment) == y:
#     print(6, "YES")
# elif x == y:
#     print(7, "YES")
# else:
#     print("NO")
print(["NO", "YES"][(x_bin[2:-1] + "1") in y_bin or \
                    (y_bin[2 + increment // 2:-(increment // 2)]) == x_bin[2::] or \
                    (x_bin[2::] + "1") in y_bin or \
                    ("1" + "".join(list(bin(x)[2:])).strip("0")) in ("".join(list(reversed(bin(y)[2:])))) or \
                    int(x_bin + "1", 2) == y or \
                    (int(x_bin + "1", 2) * (increment + 1) + increment) == y or \
                    x == y
                    ]
      )

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(2 * a + 1)

    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()
# pb(a)
# pb(b)
print("YES" if gl_can(a, b) else "NO")

import re

def do(x, y):
    match = re.search(f"^1*{x}1*$", y)
    # print(x, match)
    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:]

# print(x1, x2, x3, x4)
# print(y)

if do(x1, y) or do(x2, y) or do(x3, y) or do(x4, y):
    print("YES")
else:
    print("NO")

# Problem: F. Развороты
# Contest: Codeforces - Codeforces Round #760 (Div. 3)
# URL: https://codeforces.com/contest/1618/problem/F
# Memory Limit: 256 MB
# Time Limit: 2000 ms
#
# Powered by CP Editor (https://cpeditor.org)

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] == t[i - 1] 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] == t[i - 1] and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True
	s = s1
	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] == t[i - 1] 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] == t[i - 1] and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True

	print('YES' if ok else 'NO')
t = 1
#t = int(input())

for i in range(t):
	solve(t)

# -*- codeing =utf-8 -*-
# @Time : 2021/12/21 0:37
# @Author : 徐逸芃
# @File ：dqwqw.py
# @Software: PyCharm

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)
        n5=cal(n1)
        # print(n1,n2,n3,n4,n5)
        for tot in [n2, n3, n4,n5]:
            if tot == y:
                return True
            else:
                if tot>y or tot in vis:
                    continue
                vis.add(tot)
                q.append(tot)
    return False

x, y = map(int,input().split())
if solve(x,y):
    print("YES")
else:
    print("NO")

import math

a, b = list(map(int, input().split()))
a = bin(a)[2:]
pos = [a.strip('0'), a.strip('0')[::-1], a, (a+'1')[::-1]]
b = bin(b)[2:]
answer = False
for i in range(4):
    for j in range(len(b)):
        for k in range(len(b)):
            if '1'*j+pos[i]+'1'*k == b:
                answer = True
if answer:
    print('YES')
else:
    print('NO')

# import sys, os

# from sympy import solve
# if not os.environ.get("ONLINE_JUDGE"):
#     sys.stdin = open('in.txt', 'r')
#     sys.stdout = open('out.txt', 'w')

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

def solve(s, y):
    if len(s) > len(y):
        return False
    n = len(y) - len(s)
    for i in range(n):
        if y == '1'*i + s + '1'*(n-i):
            return True
    return False

n, k = map(int, input().split())
x = bin(n).replace('0b', '')
y = bin(k).replace('0b', '')

s1 = x + '1'
s2 = s1[::-1]
x = bin(int(x[::-1], 2)).replace('0b', '')
s3 = x
s4 = s3[::-1]

if solve(s1, y) or solve(s2, y) or solve(s3, y) or solve(s4, y):
    print("YES")
else:
    print("NO")

# region template
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
# endregion

def main() -> None:
    x, y = map(int, sinput().split())
    bx = bin(x)[2:]
    by = bin(y)[2:]
    if by[-1] == "0":
        print("NO")
        return
    s = by.find(bx)
    if s != -1:
        if "0" not in by[:s] and "0" not in by[s + len(bx) :]:
            print("YES")
            return

    if bx[-1] == "0":
        last_z = bx.rfind("0")
        bx = bx[:last_z]
        s = by.find(bx)
        if s != -1:
            if "0" not in by[:s] and "0" not in by[s + len(bx) :]:
                print("YES")
                return

    print("NO")

if __name__ == "__main__":
    main()

from sys import stdin
inp = stdin.readline

a, b = map(int, inp().split())

binA = str(bin(a))[2:]
binB = str(bin(b))[2:]

c1 = binA.strip("0")
c2 = binA + "1"

x = binB.find(c2)
if x > -1:
    if (binB[:x] + binB[x+len(c2):]).find("0") > -1:
        print("NO")
    else:
        print("YES")
elif a == b:
    print("YES")
else:
    x = binB.find(c1)
    if x > -1:
        if (binB[:x] + binB[x + len(c1):]).find("0") > -1:
            print("NO")
        else:
            print("YES")
    else:
        print("NO")

import sys
input = lambda : sys.stdin.readline().rstrip()
x, y = map(int, input().split())
if x == y:
    print('YES')
    sys.exit(0)
b = bin(x)[2:]+'1'
while x & 1 == 0:
    x >>= 1
a = bin(x)[2:]
y = bin(y)[2:]

def check(s):
    idx = y.find(s)
    if idx == -1:
        return False
    for i, e in enumerate(y):
        if idx<=i<idx+len(s):
            continue
        if e == '0':
            return False
    return True

print(a,b)
for s in [a, b, a[::-1], b[::-1]]:
    if check(s):
        print('YES')
        sys.exit(0)
print('NO')

import re

x, y = map(int, input().split())
bin_x = bin(x)[2:]
bin_xs = [
    bin_x,
    bin_x.rstrip("0"),
    bin_x[::-1],
    bin_x.rstrip("0")[::-1]
]
if bin_xs[3][0] == "0":
    bin_xs[3][0] = "1" + bin_xs[3][0]

bin_y = bin(y)[2:]

for bin_x in bin_xs:
    if re.fullmatch("1*" + bin_x + "1*", bin_y):
        print("YES")
        quit()
print("NO")

x, y = map(int, input().split())
if x == y:
    print("YES")
else:
    a = ""
    f = 0
    for i in range(64, -1, -1):
        if x & (1 << i):
            f = 1
            a += '1'
        elif f:
            a += '0'
    b = a
    if b[-1] == '0':
        b += '1'

    while a[-1] == '0':
        a = a[:-1]

    print(a)
    print(b)

    def func():
        for i in range(64):
            for j in range(64):
                c = '1'*i + a + '1'*j
                d = '1'*i + b + '1'*j

                if len(c) < 64:
                    n1 = int(c, 2)
                    n2 = int(c[::-1], 2)
                    if n1 == y or n2 == y:
                        print("YES")
                        return 1
                if len(d) < 64:
                    n1 = int(d, 2)
                    n2 = int(d[::-1], 2)
                    if n1 == y or n2 == y:
                        print("YES")
                        return 1

    if not func():
        print("NO")

def pr_r(n):
    n1 = n2 = n
    n1 += '1'
    n2 += '0'
    n1 = n1[::-1]
    n2 = bin(int(n2[::-1], 2))[2:]

    return n1, n2

a, b = [bin(int(i)) for i in input().split()]
a = a[2:]
b = b[2:]
if b.count('1') < a.count('1'):
    print('NO')
    exit()

s = [a]
for i in range(10):
    ss = []
    for j in s:
        x, y = pr_r(j)
        if x == b or y == b:
            print('YES')
            exit()
        ss.append(x)
        ss.append(y)

    s = ss.copy()

print('NO')

import re

n, m = map(int, input().split())
n = bin(n)[2:]
m = bin(m)[2:]
n_ = n[::-1].lstrip("0")

k = 0
temp = len(n)
while temp-k-1 >= 0 and n[temp-k-1] == '0':
    k += 1

p1 = re.compile("^1*" + n[:temp-k] + ("[0]{0,"+str(k)+"}" if k > 0 else "")+ "1*$")

pe = re.compile("^1+" + n[:temp-k] + ("[0]{1,"+str(k)+"}" if k > 0 else "")+ "$")

p2 = re.compile('^1*' + n_ + "1*$")

# print(n)
# print(m)
# print(pe)
# print(re.match(pe, m))
if re.match(p2, m):
    print("YES")
elif re.match(p1, m):
    if re.match(pe, m):
        print("NO")
    else:
        print("YES")
else:
    print("NO")

import math

a, b = list(map(int, input().split()))
a = bin(a)[2:]
b = bin(b)[2:]
if (a in b or a[::-1] in b) and b[-1] == '1':
    print('YES')
else:
    print('NO')

def solve(x, y):
    if x == y:
        return True
    x = bin(x)[2:]
    y = bin(y)[2:]
    xx = x.rstrip('0')
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    xx = xx[::-1]
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    xx = x[::-1]
    for i in range(len(y)-len(xx)+1):
        if x == y[i:i+len(xx)] and all(c=='1' for c in y[:i]) and all(c=='1' for c in y[i+len(x):]):
            return True
    return False

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

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

x,y=map(int,input().split())
x,y=b(x),b(y)
if len(x)>len(y):
    print('NO')
elif len(x)==len(y):
    print('NO' if x not in y else 'YES')
else:
    if x not in y:
        print('NO')
    else:
        cnt1,cnt2=0,0
        for j in x:
            if j=='0':
                cnt1+=1
        for j in y:
            if j=='0':
                cnt2+=1
        if cnt1!=cnt2:
            print('NO')
        else:
            print('YES')

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)
        # print(n1,n2,n3,n4)
        for nn in [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,input().split())
if solve(x,y):
    print("YES")
else:
    print("NO")

# Problem: F. Развороты
# Contest: Codeforces - Codeforces Round #760 (Div. 3)
# URL: https://codeforces.com/contest/1618/problem/F
# Memory Limit: 256 MB
# Time Limit: 2000 ms
#
# Powered by CP Editor (https://cpeditor.org)

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)

	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] == t[i - 1] 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] == t[i - 1] and t[i] == '0':
					tmp = False
					break
		if tmp:
			ok = True

	print('YES' if ok else 'NO')
t = 1
#t = int(input())

for i in range(t):
	solve(t)

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 len(cur) > m:
            continue
        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:
            vis.add(next1)
            queue.append(next1)
        if next2 not in vis:
            vis.add(next2)
            queue.append(next2)
    if flag:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    solve()

x, y = [int(z) for z in input().split()]
binx = bin(x)[2:]
biny = bin(y)[2:]
xidx = len(binx)
while xidx > 0 and binx[xidx-1] == 0:
    xidx -= 1

x1 = binx + '1'
x2 = binx[:xidx]
ans = False
if binx == biny:
    ans = True

d = len(biny)-len(x1)
for i in range(d+1):
    if "1"*i + x1 + "1"*(d-i) == biny:
        ans = True
    elif "1"*i + x1[::-1] + "1"*(d-i) == biny:
        ans = True

d = len(biny)-len(x2)
for i in range(d+1):
    if "1"*i + x2 + "1"*(d-i) == biny:
        ans = True
    elif "1"*i + x2[::-1] + "1"*(d-i) == biny:
        ans = True

if ans:
    print("YES")
else: print("NO")

import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]

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

if bin(y)[-1] == 0:
    if x!=y:
        print('NO')
    else:
        print('YES')

else:
    bin_x = bin(x)[2:]
    bin_y = bin(y)[2:]
    pattern = [bin_x, bin_x[::-1], bin(int(bin_x[::-1], 2))[2:]]
    flag = False
    a = []
    b = []
    c = []
    for i in range(len(bin_y)):
        if bin_y[i:i+len(pattern[0])] == pattern[0]:
            a.append(i)
        if bin_y[i:i+len(pattern[1])] == pattern[1]:
            b.append(i)
        if bin_y[i:i+len(pattern[2])] == pattern[2]:
            c.append(i)

    for i in a:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[0]):]:
            flag = True
            break
    for i in b:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[1]):]:
            flag = True
            break
    for i in c:
        if '0' not in bin_y[:i]+bin_y[i+len(pattern[2]):]:
            flag = True
            break

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

a,b = map(int, input().split())
sus = bin(a)[2:][::-1]
sussy = bin(int(bin(a)[2:][::-1]+"1",2))[2:]

bb = bin(b)[2:]
realsus = sus[::-1]
realsussy = sus[::-1]

amogus = bin(b)[2:]
lmao = False
pos = -1
leng = 0
for i in [sus, sussy, realsus, realsussy]:
    if amogus.find(i) != -1:
        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(1,len(c)-1):
        if c[i] != "1":
            lmao = True
    if len(c)>0 and c[0]=="0" and c[-1]=="0":
        lmao = True

print("YES" if not lmao else "NO")

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

x = bin(x)[2:]
y = bin(y)[2:]

x_rev = ''.join(reversed(x))
x_rev = x_rev[x_rev.index('1'):]

if x_rev in y and x_rev.count('0') == y.count('0') or x in y and x.count('0') == y.count('0'):
    print("YES")
else:
    print("NO")

def decompose(s):
    r = []
    while s > 0:
        r.append(s % 2)
        s = int(s/2)
    return r

def add(r):
    s = 0
    c = 1
    for bit in r:
        s += c * bit
        c = c * 2
    return s

def solve(a, b):
    ans = "YES"
    s = []
    check = dict()
    q = [a]
    f = 0
    while f < len(q):
        p = q[f]
        check.__setitem__(p, None)
        d = decompose(p)
        n_bits = len(d)
        d.reverse()
        pr = add(d)
        power_2 = 2 ** (n_bits - 1)
        possible = [pr, p * 2 + 1, power_2 + p, pr * 2 + 1, power_2 + pr]
        for c in possible:
            if c == b:
                print("YES")
                return
            if c not in check and c < b:
                q.append(c)
                check.__setitem__(c, None)
        f += 1
    print("NO")
    return

a, b = list(map(int, input().split()))
solve(a, b)

def pr_r(n):
    n1 = n2 = n
    n1 += '1'
    n2 += '0'
    n1 = n1[::-1]
    n2 = bin(int(n2[::-1], 2))[2:]

    return n1, n2

a, b = [bin(int(i)) for i in input().split()]
a = a[2:]
b = b[2:]
if b.count('1') < a.count('1'):
    print('NO')
    exit()

s = [a]
for i in range(22):
    ss = []
    for j in s:
        x, y = pr_r(j)
        if x == b or y == b:
            print('YES')
            exit()

        if not (x > j > b):
            ss.append(x)
        if not (b > j > a):
            ss.append(y)

    s = ss.copy()

print('NO')

x, y = map(int, input().split())
x_bin, y_bin = bin(x), bin(y)
increment = len(y_bin) - len(x_bin)
# print(x_bin, y_bin)
# print(["NO", "YES"][(x_bin[2:-1] + "1") in y_bin or \
#                     (y_bin[2 + increment // 2:-(increment // 2)]) == x_bin[2::] or \
#                     (x_bin[2::] + "1") in y_bin or \
#                     ("1" + "".join(list(bin(x)[2:])).strip("0")) in ("".join(list(reversed(bin(y)[2:])))) or \
#                     int(x_bin + "1", 2) == y or \
#                     (int(x_bin + "1", 2) * (increment + 1) + increment) == y or \
#                     x == y
#                     ]
#       )
result = ""
if x_bin == y_bin:
    result = "YES"
elif x_bin[-1] == "0":
    result = "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):
        result = "YES"
    else:
        x_bin = x_bin[:-1]
        while x_bin[-1] == "0":
            x_bin = x_bin[:-1]
            result = ("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 "NO")
# b = ["YES", "NO"][x_bin.count("0") == y_bin.count("0") or ]
print(["NO", result][result != ""])

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 = {a, 2 * a + 1}
    while a % 2 == 0:
        a //= 2
    pos_a.add(2 * a + 1)

    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()
# pb(a)
# pb(b)
print("YES" if gl_can(a, b) else "NO")

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

s_x = ""
s_x_p = ""
flag = False
while x:
    if x % 2:
        flag = True
    if flag:
        s_x = str(x % 2) + s_x
    s_x_p = str(x % 2) + s_x_p
    x //= 2
s_x_p = s_x_p + '1'

s_y = ""
flag = False
while y:
    s_y = str(y % 2) + s_y
    y //= 2

print(s_x, s_x_p, s_y)

pos1 = s_y.find(s_x)
s_y_1 = s_y[0: pos1] + s_y[pos1 + len(s_x):]
print(pos1, s_y_1, all(list(map(lambda x : x == '1', s_y_1))))
s_x = s_x[::-1]
pos2 = s_y.find(s_x)
s_y_2 = s_y[0: pos2] + s_y[pos2 + len(s_x):]
print(pos2, s_y_2, all(list(map(lambda x : x == '1', s_y_2))))

pos3 = s_y.find(s_x_p)
s_y_3 = s_y[0: pos3] + s_y[pos3 + len(s_x_p):]
print(pos3, s_y_3, all(list(map(lambda x : x == '1', s_y_3))))
s_x_p = s_x_p[::-1]
pos4 = s_y.find(s_x_p)
s_y_4 = s_y[0: pos4] + s_y[pos4 + len(s_x_p):]
print(pos4, s_y_4, all(list(map(lambda x : x == '1', s_y_4))))

if _x == _y or \
    (pos1 != -1 and all(list(map(lambda x : x == '1', s_y_1)))) or \
    (pos2 != -1 and all(list(map(lambda x : x == '1', s_y_2)))) or \
    (pos3 != -1 and all(list(map(lambda x : x == '1', s_y_3)))) or \
    (pos4 != -1 and all(list(map(lambda x : x == '1', s_y_4)))):
    print("YES")
else:
    print("NO")

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
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# input = sys.stdin.readline

def work(stt, end):
    n, m = len(stt), len(end)
    if n > m:
        return False

    q = deque()
    q.append(stt)
    seen = set()

    while q:
        t = q.popleft()
        if t not in seen:
            seen.add(t)

            p = t[::-1]
            if p == end:
                return True
            if len(p) <= m:
                q.append(p)
            p = t + "1"
            p = p[::-1]
            if len(p) <= m:
                q.append(p)
            if p == end:
                return True
    return False

# sys.setrecursionlimit(200010)
# https://codeforces.com/contest/1618/problem/F
def main():
    test = 1

    for idt in range(test):
        # n = int(input())
        a, b = map(int, input().split())
        # a = list(map(int, input().split()))
        stt = bin(a)[2:]
        end = bin(b)[2:]
        if work(stt, end):
            print("YES")
        else:
            print("NO")
    return

if __name__ == '__main__':
    main()

x, y = map(int, input().split(" "))
bin_x, bin_y = str(bin(x))[2:], str(bin(y))[2:]
ans = "NO"
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[:i1]+bin_y[i1+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)+1:])
    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)+1:])
    if len(re) == 0 or (len(re) == 1 and '1' in re):
        ans = "YES"
except:
    pass
print(ans)