#C7887. Smallest Element in Each Row

    ID: 51807 Type: Default 1000ms 256MiB

Smallest Element in Each Row

Smallest Element in Each Row

You are given an \(m \times n\) matrix of integers where each row is sorted in ascending order from left to right. Your task is to find the smallest element in each row and output them as a space-separated list.

For example, given the following matrix:

1 3 5
2 4 6
0 9 8

The smallest elements from each row are:

1 2 0

inputFormat

The first line of input contains two space-separated integers \(r\) and \(c\) representing the number of rows and columns in the matrix, respectively.

The next \(r\) lines each contain \(c\) space-separated integers representing the elements of the matrix.

outputFormat

Output a single line containing \(r\) space-separated integers, where each integer is the smallest element of the corresponding row of the matrix.

## sample
3 3
1 3 5
2 4 6
0 9 8
1 2 0