def af(a,b): ab=bin(a) bb=bin(b) ab=ab[2:] bb=bb[2:] for i in range(16-len(ab)): ab = '0'+ab # for j in range(16): flag = 1 al =list(ab) for i in range(16): t = ab[0] k=0 for o in range(15): al[k]=al[k+1] k=k+1 al[15]=t ab = "".join(al) if(int(ab)==int(bb)): flag = 0 print('YES') break if flag == 1: print("NO") while True: try: a, b=map(int, input().split()) af(a,b) except: break