{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eJohn is the only priest in his town. October 26th is the John\u0027s busiest day in a year because there is an old legend in the town that the couple who get married on that day will be forever blessed by the God of Love. This year N couples plan to get married on the blessed day. The i-th couple plan to hold their wedding from time Si to time Ti. According to the traditions in the town, there must be a special ceremony on which the couple stand before the priest and accept blessings. Moreover, this ceremony must be longer than half of the wedding time and can’t be interrupted. Could you tell John how to arrange his schedule so that he can hold all special ceremonies of all weddings?\u003cbr\u003e\u003cbr\u003ePlease note that:\u003cbr\u003e\u003cbr\u003eJohn can not hold two ceremonies at the same time.\u003cbr\u003eJohn can only join or leave the weddings at integral time.\u003cbr\u003eJohn can show up at another ceremony immediately after he finishes the previous one.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input consists of several test cases and ends with a line containing a zero.\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eIn each test case, the first line contains a integer N ( 1 ≤ N ≤ 100,000) indicating the total number of the weddings.\u003cbr\u003e\u003cbr\u003eIn the next N lines, each line contains two integers Si and Ti. (0 \u0026lt;\u003d Si \u0026lt; Ti \u0026lt;\u003d 2147483647)\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test, if John can hold all special ceremonies, print \"YES\"; otherwise, print “NO”. "}},{"title":"Sample","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\u003e3\r\n1 5\r\n2 4\r\n3 6\r\n2\r\n1 5\r\n4 6\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNO\r\nYES\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}