#C10909. IPv4 Address Validation

    ID: 40166 Type: Default 1000ms 256MiB

IPv4 Address Validation

IPv4 Address Validation

Your task is to determine whether a given string is a valid IPv4 address. An IPv4 address consists of 4 decimal numbers separated by periods. Each number must be between \(0\) and \(255\) inclusive and must not contain extra leading zeros. For example, "192.168.0.1" is valid but "123.045.067.089" is invalid because of the leading zeros.

You will be given an integer \(n\) representing the number of IP addresses, followed by \(n\) lines, each containing an IP address candidate. For each IP address, output "VALID" if it is a valid IPv4 address according to the criteria above, or "INVALID" otherwise.

inputFormat

The first line contains an integer \(n\) representing the number of IP addresses. Each of the next \(n\) lines contains a string representing an IP address candidate.

Input is read from standard input (stdin).

outputFormat

For each given IP address, print "VALID" if it is valid or "INVALID" otherwise, each on a new line.

Output should be written to standard output (stdout).

## sample
3
192.168.0.1
256.100.50.0
123.045.067.089
VALID

INVALID INVALID

</p>