#include using namespace std; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; } #define DEBUG #ifdef DEBUG void debug_out() { cerr << endl; } template void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...); } #define debug(...) \ cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl #else #define debug(...) (void(0)) #define dump(x) (void(0)) #endif struct Setup { Setup() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } __Setup; using ll = long long; #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() const double EPS = 1e-7; const int INF = 1 << 30; const ll LLINF = 1LL << 60; constexpr int MOD = 1000000007; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; //------------------------------------- int power(int n, int k) { if(k == 0) { return 1; } if(k & 1) { return n * power(n, k - 1); } else { int t = power(n, (k >> 1)); return t * t; } } int main() { int n, z; cin >> n >> z; int zn = power(z, n); for(int x = 1; x < z; x++) { for(int y = 1; y < z; y++) { int tmp = power(x, n) + power(y, n); if(tmp > zn) { break; } else if(tmp == zn) { cout << "Yes\n"; return 0; } } } cout << "No\n"; }