{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\r\n\tCalculate the number of toys that land in each bin of a partitioned toy box.\u003cbr /\u003e\r\n\tMom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They gave John a rectangular box to put his toys in, but John is rebellious and obeys his parents by simply throwing his toys into the box. All the toys get mixed up, and it is impossible for John to find his favorite toys.\u003cbr /\u003e\r\n\t\u003cbr /\u003e\r\n\tJohn\u0026#39;s parents came up with the following idea. They put cardboard partitions into the box. Even if John keeps throwing his toys into the box, at least toys that get thrown into different bins stay separated. The following diagram shows a top view of an example toy box.\u003cbr /\u003e\r\n\t\u003cimg src\u003d\"http://poj.org/images/2318_1.jpg\" /\u003e\u003cbr /\u003e\r\n\tFor this problem, you are asked to determine how many toys fall into each partition as John throws them into the toy box.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\r\n\tThe input file contains one or more problems. The first line of a problem consists of six integers, n m \u003cspan data-scayt_word\u003d\"x1\" data-scaytid\u003d\"1\"\u003ex1\u003c/span\u003e \u003cspan data-scayt_word\u003d\"y1\" data-scaytid\u003d\"3\"\u003ey1\u003c/span\u003e \u003cspan data-scayt_word\u003d\"x2\" data-scaytid\u003d\"6\"\u003ex2\u003c/span\u003e \u003cspan data-scayt_word\u003d\"y2\" data-scaytid\u003d\"8\"\u003ey2\u003c/span\u003e. The number of cardboard partitions is n (0 \u0026lt; n \u0026lt;\u003d 5000) and the number of toys is m (0 \u0026lt; m \u0026lt;\u003d 5000). The coordinates of the upper-left corner and the lower-right corner of the box are (\u003cspan data-scayt_word\u003d\"x1\" data-scaytid\u003d\"2\"\u003ex1\u003c/span\u003e,\u003cspan data-scayt_word\u003d\"y1\" data-scaytid\u003d\"4\"\u003ey1\u003c/span\u003e) and (\u003cspan data-scayt_word\u003d\"x2\" data-scaytid\u003d\"7\"\u003ex2\u003c/span\u003e,\u003cspan data-scayt_word\u003d\"y2\" data-scaytid\u003d\"9\"\u003ey2\u003c/span\u003e), respectively. The following n lines contain two integers per line, \u003cspan data-scayt_word\u003d\"Ui\" data-scaytid\u003d\"11\"\u003eUi\u003c/span\u003e Li, indicating that the ends of the \u003cspan data-scayt_word\u003d\"i-th\" data-scaytid\u003d\"13\"\u003ei-th\u003c/span\u003e cardboard partition is at the coordinates (\u003cspan data-scayt_word\u003d\"Ui\" data-scaytid\u003d\"12\"\u003eUi\u003c/span\u003e,\u003cspan data-scayt_word\u003d\"y1\" data-scaytid\u003d\"5\"\u003ey1\u003c/span\u003e) and (Li,\u003cspan data-scayt_word\u003d\"y2\" data-scaytid\u003d\"10\"\u003ey2\u003c/span\u003e). You may assume that the cardboard partitions do not intersect each other and that they are specified in sorted order from left to right. The next m lines contain two integers per line, \u003cspan data-scayt_word\u003d\"Xj\" data-scaytid\u003d\"14\"\u003eXj\u003c/span\u003e \u003cspan data-scayt_word\u003d\"Yj\" data-scaytid\u003d\"15\"\u003eYj\u003c/span\u003e specifying where the \u003cspan data-scayt_word\u003d\"j-th\" data-scaytid\u003d\"16\"\u003ej-th\u003c/span\u003e toy has landed in the box. The order of the toy locations is random. You may assume that no toy will land exactly on a cardboard partition or outside the boundary of the box. The input is terminated by a line consisting of a single 0.\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\r\n\tThe output for each problem will be one line for each separate bin in the toy box. For each bin, print its bin number, followed by a colon and one space, followed by the number of toys thrown into that bin. Bins are numbered from 0 (the leftmost bin) to n (the rightmost bin). Separate the output of different problems by a single blank line.\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e\r\n5 6 0 10 60 0\r\n3 1\r\n4 3\r\n6 8\r\n10 10\r\n15 30\r\n1 5\r\n2 1\r\n2 8\r\n5 5\r\n40 10\r\n7 9\r\n4 10 0 10 100 0\r\n20 20\r\n40 40\r\n60 60\r\n80 80\r\n 5 10\r\n15 10\r\n25 10\r\n35 10\r\n45 10\r\n55 10\r\n65 10\r\n75 10\r\n85 10\r\n95 10\r\n0\r\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e\r\n0: 2\r\n1: 1\r\n2: 1\r\n3: 1\r\n4: 0\r\n5: 1\r\n\r\n0: 2\r\n1: 2\r\n2: 2\r\n3: 2\r\n4: 2\r\n\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\r\n\tAs the example illustrates, toys that fall on the boundary of the box are \u0026quot;in\u0026quot; the box.\u003c/div\u003e"}}]}