#K37507. Serial Number Validation

    ID: 25991 Type: Default 1000ms 256MiB

Serial Number Validation

Serial Number Validation

This problem requires you to validate a series of serial numbers according to the following criteria:

  • The serial number must contain at least two different digits. In mathematical terms, if S is the set of digits of the serial, then \(|S| \geq 2\).
  • The serial number must not contain any two consecutive identical digits.

Your task is to read several serial numbers from standard input and determine for each serial number whether it is "Valid" or "Invalid" based on the criteria above.

For example, consider the serial number "120120". It contains at least two different digits and no two identical digits are adjacent, so it is valid.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains a single integer \(T\) denoting the number of serial numbers.
  2. The following \(T\) lines each contain a serial number (a non-empty string of digits).

outputFormat

For each serial number read from the input, output a single line to standard output (stdout) containing either "Valid" if the serial number meets the specified conditions or "Invalid" otherwise.

## sample
4
12345
11111
112233
120120
Valid

Invalid Invalid Valid

</p>