#C9971. Maximum Strongest Sword

    ID: 54123 Type: Default 1000ms 256MiB

Maximum Strongest Sword

Maximum Strongest Sword

You are given \( k \) swordsmiths. Each swordsmith has produced a series of swords with strictly increasing strengths. For the \( i \)-th swordsmith, you are given a list of \( n_i \) integers \( s_{i1}, s_{i2}, \dots, s_{in_i} \) (sorted in ascending order) representing the strengths of the swords they produced. Your task is to determine the maximum strength among the strongest swords of each swordsmith, that is, compute \( \max_{1 \leq i \leq k} s_{in_i} \).

Input Format: The first line contains an integer \( k \) representing the number of swordsmiths. This is followed by \( k \) lines. Each line begins with an integer \( n_i \) denoting the number of swords produced by the \( i \)-th swordsmith, followed by \( n_i \) space-separated integers in ascending order.

Output Format: Output a single integer representing the maximum strength among the strongest swords of all the swordsmiths.

inputFormat

The input is given in the following format:

 k
 n1 s11 s12 ... s1n1
 n2 s21 s22 ... s2n2
 ...
 nk sk1 sk2 ... sknk

For example, the input:

3
4 1 3 5 7
3 4 6 8
5 2 3 9 15 20

indicates there are 3 swordsmiths, with the first producing 4 swords with strengths 1, 3, 5, 7; the second producing 3 swords with strengths 4, 6, 8; and the third producing 5 swords with strengths 2, 3, 9, 15, 20.

outputFormat

Output a single integer — the maximum among the strongest swords from each swordsmith.

For the sample input above, the strongest swords are 7, 8, and 20. The maximum among these is 20, so the output is:

20
## sample
3
4 1 3 5 7
3 4 6 8
5 2 3 9 15 20
20