{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eWe have \u003cvar\u003e\\(N\\)\u003c/var\u003e irregular jigsaw pieces. Each piece is composed of three rectangular parts of width \u003cvar\u003e\\(1\\)\u003c/var\u003e and various heights joined together. More specifically:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eThe \u003cvar\u003e\\(i\\)\u003c/var\u003e-th piece is a part of height \u003cvar\u003e\\(H\\)\u003c/var\u003e, with another part of height \u003cvar\u003e\\(A_i\\)\u003c/var\u003e joined to the left, and yet another part of height \u003cvar\u003e\\(B_i\\)\u003c/var\u003e joined to the right, as shown below. Here, the bottom sides of the left and right parts are respectively at \u003cvar\u003e\\(C_i\\)\u003c/var\u003e and \u003cvar\u003e\\(D_i\\)\u003c/var\u003e units length above the bottom side of the center part.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003e\u003cimg alt\u003d\"\" src\u003d\"CDN_BASE_URL/c82ff8b7ad57723ed23a0c1294e8c1e7?v\u003d1715778292\"\u003e\u003c/p\u003e\r\n\u003cp\u003eSnuke is arranging these pieces on a square table of side \u003cvar\u003e\\(10^{100}\\)\u003c/var\u003e. Here, the following conditions must be held:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eAll pieces must be put on the table.\u003c/li\u003e\r\n\u003cli\u003eThe entire bottom side of the center part of each piece must touch the front side of the table.\u003c/li\u003e\r\n\u003cli\u003eThe entire bottom side of the non-center parts of each piece must either touch the front side of the table, or touch the top side of a part of some other piece.\u003c/li\u003e\r\n\u003cli\u003eThe pieces must not be rotated or flipped.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eDetermine whether such an arrangement is possible.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq N \\leq 100000\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq H \\leq 200\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq A_i \\leq H\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq B_i \\leq H\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(0 \\leq C_i \\leq H - A_i\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(0 \\leq D_i \\leq H - B_i\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eAll input values are integers.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(H\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_1\\)\u003c/var\u003e \u003cvar\u003e\\(B_1\\)\u003c/var\u003e \u003cvar\u003e\\(C_1\\)\u003c/var\u003e \u003cvar\u003e\\(D_1\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_2\\)\u003c/var\u003e \u003cvar\u003e\\(B_2\\)\u003c/var\u003e \u003cvar\u003e\\(C_2\\)\u003c/var\u003e \u003cvar\u003e\\(D_2\\)\u003c/var\u003e\r\n:\r\n\u003cvar\u003e\\(A_N\\)\u003c/var\u003e \u003cvar\u003e\\(B_N\\)\u003c/var\u003e \u003cvar\u003e\\(C_N\\)\u003c/var\u003e \u003cvar\u003e\\(D_N\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eIf it is possible to arrange the pieces under the conditions, print \u003ccode\u003eYES\u003c/code\u003e; if it is impossible, print \u003ccode\u003eNO\u003c/code\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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 4\r\n1 1 0 0\r\n2 2 0 1\r\n3 3 1 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eThe figure below shows a possible arrangement.\u003c/p\u003e\r\n\u003cp\u003e\u003cimg alt\u003d\"\" src\u003d\"CDN_BASE_URL/8c2a4463649618acd55708289b7bcf79?v\u003d1715778292\"\u003e\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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 2\r\n1 1 0 1\r\n1 1 0 1\r\n1 1 0 1\r\n1 1 0 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNO\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","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\u003e10 4\r\n1 1 0 3\r\n2 3 2 0\r\n1 2 3 0\r\n2 1 0 0\r\n3 2 0 2\r\n1 1 3 0\r\n3 2 0 0\r\n1 3 2 0\r\n1 1 1 3\r\n2 3 0 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}