#include #include using ll = long long; using ull = unsigned long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++) using namespace std; using namespace atcoder; using mint = modint998244353; const int inf = 1000000007; const ll longinf = 1ll << 60; ll floor(ll x, ll m) { ll r = (x % m + m) % m; return (x - r) / m; } ll ceil(ll x, ll m) { ll r = (x % m + m) % m; return (x - r) / m + (r > 0); } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; vector r(n); vector a(n); rep(i, n) cin >> r[i] >> a[i]; rep(i, n) { vector coef(n), ret(n), sc(n + 1), sr(n + 1); bool ok = true; for(int j = n - 1; j >= 0; j--) { sc[j] += sc[j + 1]; sr[j] += sr[j + 1]; if(j == i) { coef[j] = 1; sc[j] += 1; continue; } ll rsum = sr[j] - sr[r[j]]; ll csum = sc[j] - sc[r[j]]; coef[j] = -csum; ret[j] = -rsum + a[j]; sc[j] += coef[j]; sr[j] += ret[j]; } // rep(i, n) cout << coef[i] << " "; // cout << endl; // rep(i, n) cout << ret[i] << " "; // cout << endl; ll mi = 0, ma = k; rep(j, n) { if(coef[j] == 0) { if(ret[j] < 0 || ret[j] > k) { ok = false; } } if(coef[j] < 0) { mi = max(mi, ceil(ret[j] - k, abs(coef[j]))); ma = min(ma, floor(ret[j], abs(coef[j]))); } if(coef[j] > 0) { mi = max(mi, ceil(-ret[j], abs(coef[j]))); ma = min(ma, floor(-ret[j] + k, abs(coef[j]))); } } // cout << mi << " " << ma << endl; if(mi > ma) { ok = false; } cout << (ok ? "Yes" : "No") << endl; } return 0; }