#K63552. Find the Largest Element in a Sorted 'Mountain' Matrix

    ID: 31778 Type: Default 1000ms 256MiB

Find the Largest Element in a Sorted 'Mountain' Matrix

Find the Largest Element in a Sorted 'Mountain' Matrix

You are given a matrix with m rows and n columns. In the matrix, each row is sorted in non-decreasing order from left to right, and each column is sorted in non-decreasing order from top to bottom. By these properties, the largest element is always located at the bottom-right corner of the matrix.

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

Mathematically, if we denote the matrix as \(A\) with dimensions \(m \times n\), then the largest element is \(A[m-1][n-1]\).

inputFormat

The first line of input contains two space-separated integers m and n representing the number of rows and columns of the matrix.

Each of the next m lines contains n space-separated integers representing a row of the matrix.

outputFormat

Output a single integer which is the largest element in the matrix.

## sample
1 1
5
5