Given $a$, $b$, $c$, print every triple $(i, j, k)$ with $1 \le i \le a$, $1 \le j \le b$, $1 \le k \le c$, in lexicographic order, one per line as i j k.
Input
Three integers $a$, $b$, $c$ ($1 \le a, b, c \le 20$).
Output
Print all $a \cdot b \cdot c$ triples, one per line.
Example 1
Input
2 2 3
Output
1 1 1 1 1 2 1 1 3 1 2 1 1 2 2 1 2 3 2 1 1 2 1 2 2 1 3 2 2 1 2 2 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.