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