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)
Two integers n and m (1 ≤ n ≤ m, n + m ≤ 10^6
).
Print n lines. In the line i print two integers x[i]
and y[i]
. x[i]
must be in A and y[i]
in 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]
It can be proved that a solution always exists.