import math a,b=map(int,input().split()) if b!=1: print(["No","Yes"][b*math.log(a,b)==a]) elif a!=1: print(["No","Yes"][a*math.log(b,a)==b]) elif a==b:print("Yes")