#P15484. [CERC2012] The Dragon and the knights

[CERC2012] The Dragon and the knights

Description

The Dragon of the Wawel Castle, following the conflict with the local Shoemakers’ Guild, decided to move its hunting grounds out of Kraków, to a less hostile neighborhood. Now it is bringing havoc and terror to the peaceful and serene Kingdom of Bytes.

In the Kingdom of Bytes there are n rivers and each of them flows along a straight line (that is, you may think of the Kingdom as the Euclidean plane divided by infinite lines). No three rivers have a common point. The rivers divide the Kingdom into some districts.

Fortunately, there are m valiant knights in the Kingdom. Each of them has taken his post and swore an oath to protect his district. The Kingdom is thus protected for evermore... or is it?

It is known that Dragon will not attack a district which has at least one knight inside. The knights, however, are famous for their courage in battle, not for their intelligence. They may have forgotten to protect some of the districts.

Given a map of the Kingdom and the knights’ positions, determine whether all districts are protected.

Input Format

The first line of the input contains the number of test cases TT. The descriptions of the test cases follow:

Each test case starts with a line containing the number of rivers nn (1n1001\le n\le 100) and the number of knights mm (1m500001\le m\le 50000). Then follow n lines describing rivers. The j-th of them contains three space-separated integers Aj,Bj,CjA_j,B_j,C_j of absolute values not exceeding 1000010000. These integers are the coefficients of the equation Ajx+Bjy+Cj=0A_j\cdot x+B_j\cdot y+C_j=0 of the line along which the jj-th river flows. After that, there are mm lines describing the positions of the knights: the ii-th of these lines contains two integers Xi,YiX_i,Y_i (109Xi,Yi109−10^9\le X_i,Y_i\le 10^9)—the coordinates of the ii-th knight. You may assume that no knight is standing in a river (his shining armour would quickly rust if he did). Two knights may occupy the same post (their coordinates can be equal). No two rivers flow along the same line and no three rivers have a common point.

Output Format

Print the answers to the test cases in the order in which they appear in the input. For each test case, output a single line containing a single word PROTECTED if all districts are safe from the Dragon, and VULNERABLE otherwise.

2
3 7
0 1 0
1 0 0
1 1 -3
1 1
5 -1
3 2
2 -2
-2 6
-1 -2
-8 4
1 1
0 1 0
0 1
PROTECTED
VULNERABLE