SDE Path

Maximum Element in a Matrix

Easy

Maximum Element in a Matrix

Scan a grid and report its largest value.

Input format

The first line has two integers R and C. Each of the next R lines has C space-separated integers describing one row of the matrix.

Output format

Print the largest value found anywhere in the matrix.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
2 2
1 9
4 3
Expected output
9
Example 2
Input
1 4
7 2 8 5
Expected output
8