n,z=map(int,input().split()) if n<=2: f=0 for x in range(1,1001): for y in range(1,1001): f|=x**n+y**n==z**n print(["No","Yes"][f]) else: print("No")