#include using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; ll D; cin >> N >> D; vector A(N), B(N), C(N); for (int i = 0; i < N; i++) cin >> A[i] >> B[i] >> C[i]; int full = (1 << N) - 1; vector sumA(1 << N, 0); for (int S = 1; S <= full; S++) { int j = __builtin_ctz((unsigned)S); sumA[S] = sumA[S ^ (1 << j)] + A[j]; } vector>> dp(1 << N); dp[0].push_back({0LL, 0LL}); auto reduce = [](vector>& v) { if (v.size() <= 1) return; sort(v.begin(), v.end()); vector> res; ll best = LLONG_MAX; for (auto& p : v) { if (p.second < best) { res.push_back(p); best = p.second; } } v.swap(res); }; ll ans = LLONG_MAX; for (int S = 0; S <= full; S++) { if (dp[S].empty()) continue; reduce(dp[S]); if (S == full) { for (auto& pr : dp[S]) ans = min(ans, pr.second); break; } for (int j = 0; j < N; j++) { if (S & (1 << j)) continue; int T = S | (1 << j); ll c1p = sumA[T]; for (auto& pr : dp[S]) { ll c2p = max(pr.first, c1p) + B[j]; ll c3p = max(pr.second, c2p) + C[j]; dp[T].push_back({c2p, c3p}); } } vector>().swap(dp[S]); } cout << (ans <= D ? "Yes" : "No") << "\n"; return 0; }