{"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\"\u003eHere comes our future artist. See, he is painting again, this time on home\u0027s white wall, using different color of paint. Let me see, red, yellow, black, green... but why does he just paint rectangles? Pretty guy, seems he is fond of it.\u003cbr\u003e\u003cbr\u003eSo, after he\u0027s done his great job, the white wall has been filled with so many blocks of color. Of course, some color previously painted has been covered by some color painted later. Now, the little guy has some doubt that how many different colors have been left on the wall, and what are the areas of them. As a seven-year-old boy, he has just learned painting in kindergarten, math seems too difficult for him. So he turns to you, a college student good at math and programming, to help him figuring it out. Don\u0027t make him disappointed.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Input consists of multiple test cases, each describing \"a great job\" done by out little guy.\u003cbr\u003e\u003cbr\u003eEach case begins with a line containing two integers, Height and Width, the size of the wall. The next line contains an integer N, which is the number of rectangles that have been painted. N lines follow, describing the rectangles in the order they were painted. Each line contains five integers, Top, Left, Bottom, Right, and Color, giving out the position, size and color information of the rectangle.\u003cbr\u003e\u003cbr\u003eThe range of Height and Width is [1, 10000]. There will be at least 1, and at most 100 rectangles to be painted. For each rectangle, Top and Bottom is in the range [0, Height], Left and Right is in the range [0, Width]. Bottom is strictly greater than Top, and Right is strictly greater than Left. Color will be in the range [1, 100].\u003cbr\u003e\u003cbr\u003eThe top-left coordinate of the wall is (0, 0), and the bottom-right coordinate of the wall is (Height, Width), as shown below.\u003cbr\u003e\u003cpre\u003e\u003cbr\u003e\u003cbr\u003e(0,0) (0,W)\u003cbr\u003e---------------\u003cbr\u003e| |\u003cbr\u003e| |\u003cbr\u003e| |\u003cbr\u003e| |\u003cbr\u003e| |\u003cbr\u003e---------------\u003cbr\u003e(H,0) (H,W)\u003cbr\u003e\u003cbr\u003e\u003c/pre\u003e\u003cbr\u003e\u003cbr\u003eThe last case is followed by a line containing two zeroes.\u003cbr\u003e\u003cbr\u003eThere is a blank line between two test cases.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each painting, first output \"Case X:\" in a single line where X is the case number starting form 1. Then output the colors left and their areas, one color per line, in the order of color numbers (increasing). For each color, you should output the color number, a blank space, and the area of this color on the wall. After that, you should output a single line \"There is M color left on the wall.\" or \"There are M colors left on the wall.\", depending on M, which is the number of colors left on the wall.\u003cbr\u003e\u003cbr\u003eOutput a blank line between two test cases.\u003cbr\u003e"}},{"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\u003e10 5\r\n1\r\n1 1 2 2 2\r\n\r\n4 4\r\n2\r\n0 0 3 3 1\r\n2 2 4 4 2\r\n\r\n0 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1:\r\n2 1\r\nThere is 1 color left on the wall.\r\n\r\nCase 2:\r\n1 8\r\n2 4\r\nThere are 2 colors left on the wall.\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}