Folding Code

No attempts yetTime limit2sMemory limit256 MB

Problem

The organisers handed out paper evaluation forms at the end of the contest. That was a surprise for a programming contest team that did all of its work digitally. Nobody on the team carried a pen or a pencil, and borrowing one was not an option. They still wanted to submit their evaluations. The form was multiple choice, so answering a question only meant marking the preferred option, and the team worked out a way of filling in the form by folding it.

To answer a question they folded one of the corners of the page over so that it landed on the box of the option they wanted, and creased the paper along the straight fold line. The choice of corner was free. After answering a question they flattened the paper again, and they repeated the process for every answer they wanted to give. The result is a sheet of paper with one fold line for each answer.

Reading such a form back is easy: make each fold again and see where it points. The organisers were digital enthusiasts too. They scanned every evaluation form, destroyed it, and analysed the scans. The scans still showed a shadow along each fold line, so an operator could record the points at which a fold line met the edge of the paper.

Given the list of fold line endpoints and the positions and sizes of the questions, the options and the tick boxes, decode the evaluation form.

A fold line always joins two points that lie on adjacent edges of the page. The corner shared by those two edges is the corner that was folded, and the mirror image of that corner across the fold line is the point the fold points at. That point always lies inside a tick box.

Here is an example evaluation form. In the right image the top right corner has been folded over to give the answer "Perfect" to the first question.

Input

The first line contains four integers WW, HH, QQ and FF. WW and HH are the width and the height of the form in mm (100W,H1000100 \le W, H \le 1000), QQ is the number of questions on the form (0<Q100 < Q \le 10), and FF is the number of folds to decode (0<F1000 < F \le 100).

Then QQ question descriptions follow. The first line of each question description holds five integers AA, xx, yy, ww, hh followed by the text of the question. AA is the number of answers to the question (0<A100 < A \le 10). The values xx and yy are the coordinates of the top left corner of an enclosing rectangle for the question text, and ww and hh are its width and height (0<x+w<W0 < x + w < W, 0<y+h<H0 < y + h < H).

The next AA lines hold one answer description each. Each line holds eight integers x1x_1, y1y_1, w1w_1, h1h_1, x2x_2, y2y_2, w2w_2, h2h_2 followed by the text of the answer. The first four values define an enclosing rectangle for the answer text and the last four define the tick box. (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) are the top left corners of the two rectangles, and w1w_1, h1h_1, w2w_2, h2h_2 are their widths and heights. All rectangles have positive area and fit within the page. No two rectangles overlap, but they may touch. Every question text and answer text is non-empty and at most 100 characters long.

After the question descriptions come FF lines, each describing one fold. Each line holds four integers x1x_1, y1y_1, x2x_2, y2y_2, the coordinates of the two points at which the fold meets an edge of the paper.

The coordinate system is in millimetres, (0,0)(0, 0) is the top left corner of the page and (W,H)(W, H) is the bottom right corner. A point where a fold meets an edge has one coordinate that is exactly 00 (top or left), WW (right) or HH (bottom). A fold line runs between adjacent edges and never passes through a corner. No tick box is ticked by more than one fold, and FF is at most the total number of tick boxes. Every fold is valid: the point it points at lies inside a tick box and is at least 0.10.1 mm away from the border of that box.

All items on a line are separated by a single space. The input contains a single form.

Output

Print one line per question, in the order the questions are given. Each line holds the question text, a colon, a space, and then the texts of the ticked answers of that question joined by a semicolon and a space (; ). List the answers in the order they are given in the input. For a question with no ticked answer print only the question text and the colon. Some questions have more than one answer.