#K4896. Find the Largest Element in a Matrix

    ID: 28536 Type: Default 1000ms 256MiB

Find the Largest Element in a Matrix

Find the Largest Element in a Matrix

You are given a matrix represented by its rows. The first line of the input contains an integer \(n\) representing the number of rows in the matrix. Each of the following \(n\) lines contains a sequence of integers separated by spaces, representing the elements of that row. Note that the number of integers in each row can vary.

Your task is to find and print the largest integer present in the given matrix.

Input Format: The first line contains an integer \(n\). The next \(n\) lines each contain space-separated integers.

Output Format: Output a single integer, which is the largest value in the matrix.

inputFormat

The input is read from standard input (stdin) and consists of:

  • The first line contains an integer \(n\), the number of rows.
  • The next \(n\) lines each contain a row of the matrix with space-separated integers.

outputFormat

Output a single integer which is the largest integer found in the matrix. The output is written to standard output (stdout).

## sample
3
1 2 3
2 3 4
3 4 5
5