CF1816A.Ian Visits Mary

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Ian Visits Mary

Ian and Mary are frogs living on lattice points of the Cartesian coordinate plane, with Ian living on (0,0)(0,0) and Mary living on (a,b)(a,b).

Ian would like to visit Mary by jumping around the Cartesian coordinate plane. Every second, he jumps from his current position (xp,yp)(x_p, y_p) to another lattice point (xq,yq)(x_q, y_q), such that no lattice point other than (xp,yp)(x_p, y_p) and (xq,yq)(x_q, y_q) lies on the segment between point (xp,yp)(x_p, y_p) and point (xq,yq)(x_q, y_q).

As Ian wants to meet Mary as soon as possible, he wants to jump towards point (a,b)(a,b) using at most 22 jumps. Unfortunately, Ian is not good at maths. Can you help him?

A lattice point is defined as a point with both the xx-coordinate and yy-coordinate being integers.

Input

The first line contains a single integer tt (1t5001 \le t \le 500) — the number of test cases. The description of test cases follows.

The first and only line of each test case contains two integers aa and bb (1a,b1091\le a,b\le 10^9) — the coordinates of the lattice point where Mary lives.

Output

For each test case, print an integer nn (1n21 \le n \le 2) on the first line, denoting the number of jumps Ian uses in order to meet Mary. Note that you do not need to minimize the number of jumps.

On the ii-th line of the next nn lines, print two integers 0xi,yi1090 \le x_i,y_i \le 10^9 separated by a space, denoting Ian's location (xi,yi)(x_i,y_i) after the ii-th jump. xn=ax_n = a, yn=by_n = b must hold.

Ian's initial location and his locations after each of the nn jumps need not be distinct.

If there are multiple solutions, output any.

Note

In the first test case:

(0,0)(3,4)(0,0) \to (3,4)

In the second test case:

(0,0)(3,2)(4,4)(0,0) \to (3,2) \to (4,4)

In the third test case:

(0,0)(5,3)(3,6)(0,0) \to (5,3) \to (3,6)

Samples

8
3 4
4 4
3 6
2 2
1 1
7 3
2022 2023
1000000000 1000000000
1
3 4
2
3 2
4 4
2
5 3
3 6
2
1 0
2 2
1
1 1
1
7 3
1
2022 2023
2
69420420 469696969
1000000000 1000000000

在线编程 IDE

建议全屏模式获得最佳体验