#C14256. Nested List Maximum Finder

    ID: 43885 Type: Default 1000ms 256MiB

Nested List Maximum Finder

Nested List Maximum Finder

You are given several lists of integers, some of which may be empty. Your task is to find the maximum integer among all the provided numbers. The input format is as follows: the first line contains an integer \(T\) representing the number of sublists. Each of the next \(T\) lines starts with an integer \(n\) (the number of elements in that sublist), followed by \(n\) integers. It is guaranteed that at least one sublist is non-empty.

For example, if the input is:

3
3 5 12 7
3 3 14 6
3 8 4 10

Then the output should be:

14

Formally, if the input sublists are \(L_1, L_2, \dots, L_T\) where each \(L_i = [a_{i1}, a_{i2}, \dots, a_{in_i}]\), you need to compute \[ \max_{1 \le i \le T,\, 1 \le j \le n_i} a_{ij} \]

inputFormat

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

  • The first line contains a single integer \(T\), the number of sublists.
  • Each of the next \(T\) lines begins with an integer \(n\) (the number of elements in the sublist), followed by \(n\) integers separated by spaces.

outputFormat

Print to standard output (stdout) a single integer representing the maximum value among all the integers in all sublists.

## sample
3
3 5 12 7
3 3 14 6
3 8 4 10
14