#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; vector> f(int64_t x) { vector> ps; for (int64_t i = 2; i * i <= x; ++i) { int32_t c = 0; while (x % i == 0) { ++c; x /= i; } if (c > 0) ps.push_back({i, c}); } if (x > 1) ps.push_back({x, 1}); return ps; } int main() { int32_t a, b; cin >> a >> b; auto aps = f(a), bps = f(b); for (auto &&[p, c] : aps) { c *= b; } for (auto &&[p, c] : bps) { c *= a; } sort(aps.begin(), aps.end()); sort(bps.begin(), bps.end()); cout << (aps == bps ? "Yes" : "No") << endl; return 0; }