Time Limit: Java: 2000 ms / Others: 2000 ms

Memory Limit: Java: 65536 KB / Others: 65536 KB

The biologist Mr.R likes cultivating bacteria on the culture medium. What is interesting is that the new cultivated bacterial colonies always form a rectangle, whose sides are parallel with the x-axis or the y-axis of the plane.

One day, Mr.R cultivated a lot of bacteria on the culture medium. Some of the colonies were overlapping. To his surprise, he found all the new cultivated bacteria defeat the old ones, which means when the new bacteria had been cultivated, the old bacteria lived in the new bacteria's colony disappeared.

Mr.R has picked out some of the bacteria and he wants to know which bacteria have defeated them.

The problem has multiple test cases.

For each test case, the first line contains a integer n (1 <= n <= 500), which represents the total number of bacteria.

The next n lines describe the colonies of the bacteria. Each line has four integers x1 y1 x2 y2 (x1

The following line contains a number m ( m <= n ), which means the number of the bacteria that Mr.R picked out.

The last line of the test case contains m numbers (between 1 and n) indicating the picked out bacteria.

For each test case, there are m lines. The first number of each line is the number of the bacteria that have defeated the selected one, and then list them out in increasing order. The first line contains the answer to the first selected bacteria; the second line contains the answer to the second, etc.

Output a blank line after each test case.

提交代码