Input consists of multiple test cases, each describing "a great job" done by out little guy.
Each 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.
The 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].
The top-left coordinate of the wall is (0, 0), and the bottom-right coordinate of the wall is (Height, Width), as shown below.
(0,0) (0,W)
---------------
| |
| |
| |
| |
| |
---------------
(H,0) (H,W)
The last case is followed by a line containing two zeroes.
There is a blank line between two test cases.