Toy Bricks

Time Limit: 1 Second    Memory Limit: 32768 KB

Polivic rushed home as the vacation starts, to see his girlfriend, only to find her playing toy bricks. So he cheerly joined. But soon he messed the bricks all around and was requested to tidy the whole thing up.

Through careful observation, Polivic arrived at the conclusion that all the bricks are either a taper or a ball (He never realized this when he was playing). His girl has a nice box to hold the bricks. There are several pillars ericting from the bottom of the box, and as high as the box itself. Each brick can be fixed on a pillar.

Moving around with bricks is a nightmare! Polivic managed to write down the sequence he wanted to do the trick. Now he needs a program to tell him whether a specified sequence accomodates all the bricks into the box.

Input

Input contains multiple tests. The first line is an integer N, the number of tests (0 < N <= 20). Each test is in the form:

Line Number
Content
1
L W H (Length, Width, Height of the box, < 1000)
2
n (Number of pillars, 0 < n <= 100)
3

xi yi (Position of pillars,
0 <= xi <= L
0 <= yi <= H)

...
n+2
n+3
m (Number of bricks, 0 <= m <= 1000)
n+4

pi ti (Position of brick, 1 <= pi <= n, Type of brick)
if ti = 1, ri li - radius and height of taper
if ti = 2, ri - radius of ball

...
n+m+3

Note:

1. Ingore space taken by pillars;

2. Polivic has to put all the bricks into the box in the specified sequence, so that no bricks is higher than the top of the box;

3. Pillars won't have identical position, and are ordered 1 to n as in the input.

Output

For each test, print "^^" if the bricks can be arranged into the box, ".\/." otherwise.

Sample Input

2

15 10 10
2
5 5
10 5
2
2 1 4 10
1 2 2

15 10 10
2
5 5
10 5
2
1 2 2
2 1 4 10

Sample Output

 ^^
.\/.




	
Submit

Source: ZOJ Monthly, February 2003