This Too Shall Pass

No attempts yetTime limit3sMemory limit256 MB

Problem

A soccer field is drawn as a grid with rr rows and cc columns. Every player takes up one grid square, and the oo offensive players and the dd defensive players all stand on different squares. The offensive players are numbered from 1 in the order they appear in the input, and player 1 has the ball.

A defender can step to a neighboring square to intercept a pass, so one defender guards the square he stands on plus the eight squares that meet it along a side or at a corner, nine squares in all. Squares that fall outside the grid are not counted. Guarded areas of different defenders may overlap.

Player kk is open when the segment that joins the center of player 1's square to the center of player kk's square touches no guarded square at any point. Grazing a single corner point of a guarded square is enough for the pass to be intercepted. If a defender guards player 1's own square or the receiver's square, an endpoint of the segment already lies inside a guarded square, so that pass is not open. Offensive players never block a pass to another offensive player.

Find every offensive player that player 1 can pass to.

Input

The input holds several test cases.

The first line of each test case holds four integers rr, cc, oo, dd separated by spaces: the number of rows, the number of columns, the number of offensive players, and the number of defensive players. (1r501 \le r \le 50, 1c501 \le c \le 50, 1o1 \le o, 0d0 \le d, o+dr×co + d \le r \times c)

The next oo lines each hold the row and the column of one offensive player. Rows and columns are numbered from 0, so a row number is less than rr and a column number is less than cc. The next dd lines hold the defenders in the same format. No two players stand on the same square.

The offensive players are numbered from 1 in the order given, and player 1 has the ball.

A line reading 0 0 0 0 ends the input. That line is not a test case.

Output

For each test case, print Case x: on one line, then the numbers of the offensive players that player 1 can pass to, in increasing order. Put one space in front of each number. xx is the test case number counted from 1.

If no player is open, print Case x: with nothing after it.