Given $a$ and $b$, print every pair $(i, j)$ with $1 \le i \le a$ and $1 \le j \le b$, in lexicographic order, one pair per line as i j.
Input
Two integers $a$ and $b$ ($1 \le a, b \le 30$).
Output
Print all $a \cdot b$ pairs, one per line.
Example 1
Input
2 3
Output
1 1 1 2 1 3 2 1 2 2 2 3
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.