#include #include #include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll a,b; cin>>a>>b; auto calc = [](ll a,ll b){ vector> res; ll now = a; for(ll i = 2;i*i<=a;i++) if(now%i==0){ ll cnt = 0; while(now%i==0){ now /= i; cnt++; } res.push_back(make_pair(i,cnt)); } if(now!=1) res.push_back(make_pair(now,1)); for(auto&use:res) use.second *= b; sort(res.begin(),res.end()); return res; }; if(calc(a,b)==calc(b,a)) cout<<"Yes\n"; else cout<<"No\n"; }