import sys input=sys.stdin.readline #sys.setrecursionlimit(10**6) n,z=map(int,input().split()) r=range(1,1501) ans=z**n if n>=3: print("No") exit() for x in r: for y in r: X=x**n Y=y**n if X+Y==ans: print("Yes") exit() if max(X,Y)>10**6:break print("No")