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