Hide

Problem B
Coordinate Validation

Your friend Z has been planning a hike for you both for over a year now. Unfortunately at the last minute, Z came down with a terrible cold and is unable to go. Unlike Z, you aren’t an expert hiker and are worried about getting lost. Being the good friend he is, Z has written down a list of GPS coordinates for the hike. However, given Z’s current state, you are a little worried that he may have made some mistakes. You are fairly confident that as long as the coordinates are valid, they are correct. A valid GPS coordinate consists of a longitude and latitude. The longitude must be between $-180^{\circ }$ and $180^{\circ }$ (inclusive), while the latitude must be between $-90^{\circ }$ and $90^{\circ }$ (also inclusive).

Can you determine which of the GPS coordinates Z has written down are valid?

Input

The first line of input contains a single integer $n$ ($3 \leq n \leq 1000$), the number of GPS coordinates Z has written down. The next $n$ lines each contain two real numbers $\text{lon}_i$ and $\text{lat}_i$ ($-360.0000 \leq \text{lon}_i, \text{lat}_i \leq 360.0000$) each with $4$ digits after the decimal, the longitude and latitude of the $i$th GPS coordinate Z has written down in degrees.

Output

For each of the $n$ GPS coordinates, print a single line containing VALID if the coordinate is valid, or INVALID if it is not.

Sample Input 1 Sample Output 1
3
10.2000 90.0000
-180.4000 28.6000
180.0000 -90.0000
VALID
INVALID
VALID

Please log in to submit a solution to this problem

Log in