Problem list
Log in
#r02963 · Online Judge > GoldOJ

All Ordered Pairs

Bronze III 2.0 s 1024 MB

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
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code