{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eA recently founded \"NERC\" (New Era Russian Coders) company, of course, has an accounting department. And they are very concerned about the budget of the company. In particular, they don\u0027t want the company to experience a \u003cspan class\u003d\"tex-font-style-it\"\u003ecash gap\u003c/span\u003e\u0026nbsp;— a condition where they need to pay more money than they have in their account now.\u003c/p\u003e\u003cp\u003eAt the moment the company has $$$s$$$ euros on its account. The chief accountant has prepared a plan of transactions for $$$m$$$ following days. During this period $$$n$$$ transactions are planned.\u003c/p\u003e\u003cp\u003eFor each transaction the change it makes to the company\u0027s account is known, but the exact date of the operation is unknown. Money transferred by clients may not be credited to the account immediately, and on the other hand, a claim to pay a bill can suddenly be received. For each transaction, only the range of days the transaction can happen is known in advance. If several transactions would happen on the same day, they can be performed in any order.\u003c/p\u003e\u003cp\u003eHelp the accounting department to check if there exists an order of transactions such that the company will experience a cash gap. \u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains integers $$$n$$$, $$$m$$$ and $$$s$$$\u0026nbsp;— the number of payments, the number of days in the plan and the initial amount of money the company has ($$$1 \\leqslant n, m \\leqslant 1000$$$; $$$1 \\leqslant s \\leqslant 10^6$$$).\u003c/p\u003e\u003cp\u003eThe $$$i$$$-th of the following $$$n$$$ lines contains a description of the $$$i$$$-th payment in the following format: \"$$$\\mathtt{count}~\\mathtt{from}~\\mathtt{to}$$$\", which means that on any day from $$$\\mathtt{from}$$$ to $$$\\mathtt{to}$$$, the amount of money will be changed by $$$\\mathtt{count}$$$ euros ($$$-10^6 \\leqslant \\mathtt{count} \\leqslant 10^6$$$; $$$1 \\leqslant \\mathtt{from} \\leqslant \\mathtt{to} \\leqslant m$$$).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e\" if a cash gap can occur, or \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e\" if such situation is impossible.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 3 100\n100 1 2\n-100 1 2\n1 2 3\n0 3 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNO\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 3 100\n100 1 2\n-100 1 2\n1 2 3\n-1 2 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first example there is a single transfer from the account, and thus before it there will be at least $$$100$$$ euros available in the account, so the cash gap is impossible.\u003c/p\u003e\u003cp\u003eIn the second example, it could happen that both transfers from the account (for $$$100$$$ euros and for $$$1$$$ euro) will be requested on the second day, before all other transactions. In this case by the time the second transaction occurs there will be no money left on the account\u0026nbsp;— it\u0027s a cash gap.\u003c/p\u003e"}}]}