#ifdef NACHIA #define _GLIBCXX_DEBUG #else // disable assert #define NDEBUG #endif #include #include #include #include using namespace std; using ll = long long; const ll INF = 1ll << 60; #define REP(i,n) for(ll i=0; i using V = vector; template void chmax(A& l, const B& r){ if(l < r) l = r; } template void chmin(A& l, const B& r){ if(r < l) l = r; } #include namespace nachia{ bool IsPrime(unsigned long long x){ if(x <= 1 || x % 2 == 0) return x == 2; using u64 = unsigned long long; using u128 = __uint128_t; u64 d = x-1; int s = 0; int q = 63; while(!(d&1)){ d >>= 1; s++; } while(!(d >> q)) q--; u64 r = x; for(int t=0; t<6; t++) r *= 2-r*x; u128 n2 = -(u128)x % x; auto red = [=](u128 t) -> u64 { u64 g = (t + (u128)((u64)t*-r)*x) >> 64; return (g >= x || g < (t >> 64)) ? g-x : g; }; u64 one = red(n2); for(u64 b : { 2, 325, 9375, 28178, 450775, 9780504, 1795265022 }){ if(b%x==0) continue; u64 a = b = red(b%x*n2); for(int e=q-1; e>=0; e--){ a = red((u128)a*a); if((d>>e)&1) a = red((u128)a*b); } if(a == one) continue; for(int t=1; t> N; if(N <= Z && dp[Z]) cout << (dp[N] ? "Yes\n" : "No\n"); else cout << "Yes\n"; } int main(){ cin.tie(0)->sync_with_stdio(0); dp[0] = 1; for(ll p=2; p<=Z; p++) if(nachia::IsPrime(p)){ for(ll i=Z; i>=p; i--) dp[i] |= dp[i-p]; } ll T; cin >> T; REP(t,T) testcase(); return 0; }