{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"epigraph\"\u003e\u003cdiv class\u003d\"epigraph-text\"\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eIt is not in the stars to hold our destiny but in ourselves.\u003c/span\u003e\u003c/div\u003e\u003cdiv class\u003d\"epigraph-source\"\u003e— William Shakespeare, \u003cspan class\u003d\"tex-font-style-it\"\u003eJulius Caesar\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cp\u003eYou are playing a computer game. To pass the current level, you need to kill all monsters solo.\u003c/p\u003e\u003cp\u003eAs a \u003cspan class\u003d\"tex-font-style-it\"\u003ePlayer\u003c/span\u003e, your power is quantified in two properties $$$A$$$ and $$$B$$$.\u003c/p\u003e\u003cp\u003eIn this level, there are $$$n$$$ monsters. The $$$i$$$-th monster has two properties $$$a_i$$$ and $$$b_i$$$. To kill the $$$i$$$-th monster, you need more power correspondingly, i.e. $$$A \\geq a_i$$$ and $$$B \\geq b_i$$$.\u003c/p\u003e\u003cp\u003eNote that different monsters can have the \u003cspan class\u003d\"tex-font-style-bf\"\u003esame\u003c/span\u003e properties.\u003c/p\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eThe Designer\u003c/span\u003e limits your initial properties and gives you ways below to promote them.\u003c/p\u003e\u003cp\u003eInitially, your properties are $$$A\u003d10, B\u003d10$$$. If you killed the $$$i$$$-th monster, you\u0027ll get exactly $$$c_i$$$ distributable points. Each point can promote \u003cspan class\u003d\"tex-font-style-bf\"\u003eexactly one\u003c/span\u003e property by $$$1$$$ forever, i.e. $$$A :\u003d A + 1$$$ or $$$B :\u003d B + 1$$$. You can use these points at any time, but each point can be used only \u003cspan class\u003d\"tex-font-style-bf\"\u003eonce\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eNow you can kill the monsters in any order, determine whether you can kill them all.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ $$$(1 \\leq t \\leq 10^3)$$$, denoting the number of test cases.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains a single integer $$$n$$$ $$$(1 \\leq n \\leq 10 ^ 3)$$$, denoting the number of monsters.\u003c/p\u003e\u003cp\u003eThe $$$i$$$-th of the next $$$n$$$ lines contains three integers $$$a_i, b_i, c_i$$$ $$$(1 \\leq a_i, b_i, c_i \\leq 10 ^ 9)$$$, denoting the two properties of the $$$i$$$-th monster and the distributable points you will get after killing the $$$i$$$-th monster.\u003c/p\u003e\u003cp\u003eIt\u0027s guaranteed that the sum of $$$n$$$ over all test cases doesn\u0027t exceed $$$4 \\times 10 ^ 3$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eYes\u003c/span\u003e if you can kill monsters in some order. Otherwise, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eNo\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eYou may print each letter in any case. For example, \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eyes\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eYes\u003c/span\u003e will all be recognized as positive answer, \u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eno\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003enO\u003c/span\u003e will all be recognized as negative answer.\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\n1\n11 11 2\n3\n1 1 1\n2 2 2\n3 3 3\n4\n8 8 1\n11 10 1\n11 10 1\n11 12 1\n4\n1 5 10\n20 32 1\n10 22 10\n20 10 12\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNo\nYes\nYes\nYes\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 test case, there is only one monster. If you want to kill it, you must at least promote your properties to $$$A\u003d11, B\u003d11$$$, but obviously you can\u0027t. You can not get $$$c_1$$$ before killing it.\u003c/p\u003e\u003cp\u003eIn the second test case, all the monsters are weaker than your initial properties $$$A\u003d10, B\u003d10$$$, so you can kill them all in any order.\u003c/p\u003e\u003cp\u003eIn the third test case, you can kill the monsters in the order of the input.\u003c/p\u003e\u003cp\u003eIn the fourth test case, one possible order is:\u003c/p\u003e\u003col\u003e \u003cli\u003e Kill the $$$1$$$-st monster, and use all the points you get to promote $$$A$$$. After that, $$$A\u003d20, B\u003d10$$$. \u003c/li\u003e\u003cli\u003e Kill the $$$4$$$-th monster, and use all the points you get to promote $$$B$$$. After that, $$$A\u003d20, B\u003d22$$$. \u003c/li\u003e\u003cli\u003e Kill the $$$3$$$-rd monster, and use all the points you get to promote $$$B$$$. After that, $$$A\u003d20, B\u003d32$$$. \u003c/li\u003e\u003cli\u003e Kill the $$$2$$$-nd monster, and you can pass the level. \u003c/li\u003e\u003c/ol\u003e"}}]}