#K34657. Validated String Array

    ID: 25358 Type: Default 1000ms 256MiB

Validated String Array

Validated String Array

You are given an array of strings. Your task is to determine whether the array is valid according to the following four conditions:

  • The array must not be empty.
  • All strings must have the same length.
  • If each string is interpreted as an integer, then they must form a strictly increasing sequence, i.e. $$a_1 < a_2 < \cdots < a_n.$$
  • No string should start with a zero unless the string is exactly "0".

If all conditions are satisfied, print Valid. Otherwise, print Invalid.

inputFormat

The input is given from standard input and consists of multiple lines:

  1. The first line contains an integer n indicating the number of strings.
  2. The following n lines each contain one non-empty string composed of digits.

outputFormat

Output a single line to the standard output: either Valid if the array of strings satisfies the criteria, or Invalid otherwise.

## sample
3
123
234
345
Valid