An ingestion pipeline needs to filter malformed IP addresses. A string is a
valid IPv4 address when ALL of the following hold:
- it has exactly 4 parts separated by single dots
- every part consists only of digits (no signs, spaces, or letters)
- every part's numeric value is between 0 and 255 inclusive
- no part has a leading zero (the part "0" itself is fine, "01" is not)
For each input line print "valid" or "invalid".
Input Format:
Line 1: n (number of candidate addresses)
Lines 2 to n+1: one candidate string per line
Output Format:
For each candidate, "valid" or "invalid" on its own line.