~/algor $ cat problems/matritsa-ustunma-ustun-raqamlash
Column-wise numbering
Easy
1000 ms
64 MB
20%
Fill a table of $n$ rows and $m$ columns with the numbers from $1$ to $n \cdot m$ column by column: the first column top to bottom gets $1, 2, \dots, n$, the second $n + 1, \dots, 2n$, and so on. Print the table.
Input
One line with two positive integers: $n$ and $m$.
Output
$n$ lines with $m$ numbers each.
Note
$1 \le n, m \le 100$
Examples
Input #1
3 4
Output #1
1 4 7 10 2 5 8 11 3 6 9 12
Input #2
1 1
Output #2
1