#include #include #include using namespace std; const int N=100010; struct darling { int s,t,m,mt; } a[N]; int n; bool cmp(darling x,darling y) { if(x.m==y.m) return x.sa[i].t-a[i].mt) break; if(t>=a[i].s) t+=a[i].mt; else t=a[i].m; } if(i==n) printf("YES\n"); else printf("NO\n"); } return 0; }