Competitions

# Azerbaijan 2022: Qualifying exam in the preparation group for the International Olympiad October 29

# Perfect match

You are given two integers **n** and **m**. Construct such pairs (**x**, **y**) from sets **A** = {**0**, **1**, **2**, ..., **n** − **1**} and **B** = {**m**, ..., **m** + **n** − **1**} so that all pairs (**x**, **y**) (**x** ∈ **A** and **y** ∈ **B**) satisfies the condition **x** & **y** = **x** (Here & stands for the bitwise AND operation)

#### Input

Two integers **n** and **m** (**1** ≤ **n** ≤ **m**, **n** + **m** ≤ `10`

).^{6}

#### Output

Print **n** lines. In the line **i** print two integers `x`

and _{i}`y`

. _{i}`x`

must be in _{i}**A** and `y`

in _{i}**B**. Each of these pairs that you output must be a matching pair, as specified in the problem statement.

**0**≤`x`

≤_{i}**n**−**1**and for any**i**≠**j**should be`x`

≠_{i}`x`

_{j}**m**≤`y`

≤_{i}**m**+**n**−**1**and for any**i**≠**j**should be`y`

≠_{i}`y`

_{j}

#### Note

It can be proved that a solution always exists.

Input example #1

3 4

Output example #1

0 4 1 5 2 6

Input example #2

6 7

Output example #2

0 8 1 9 2 10 3 11 4 12 5 7