import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines n, z = map(int, readline().split()) x = 1 while x ** n < z ** n: y = 1 while x ** n + y ** n <= z ** n: if x ** n + y ** n == z ** n: print('Yes') quit() y += 1 x += 1 print("No")