Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/matritsa-qatorlarni-teskari

Rows in reverse order

Easy 1000 ms 128 MB 29%
Share

An integer matrix of size $n \times m$ is given. Print its rows in reverse order (the last row first, then the one before it, and so on); the order inside each row stays the same.

Rearranging the rows of the matrix in reverse order

Input

The first line contains two positive integers $n$ and $m$. Each of the next $n$ lines contains $m$ integers.

Output

$n$ lines with $m$ space-separated integers each.

Note

$1 \le n, m \le 200$
$-1000 \le a_{i,j} \le 1000$

Examples

Input #1
2 3
1 -2 3
-4 5 6
Output #1
-4 5 6
1 -2 3
Input #2
1 2
7 8
Output #2
7 8

Sign in to submit a solution

Signing up is free and takes a minute.