There is a square billiard table whose four sides each have unit length, with a pocket at every one of the four corners. A ball is struck from one corner and travels in a straight line. Whenever it strikes a side of the table at a point that is not a corner, it reflects like a mirror and keeps moving, until it finally reaches a corner and drops into that pocket.
The four sides of the table are labeled N (north), S (south), E (east), and W (west), and the four corners are labeled 1, 2, 3, and 4 as shown below. Place the table in the plane so that corner 1 is at the origin, side S lies along the x-axis, and side W lies along the y-axis.

The ball starts at the origin (corner 1). Given the slope of the line along which it leaves corner 1, determine the sequence of sides it bounces off and the corner where it finally drops into a pocket.
For example, if the starting slope is 3/5, the ball leaves corner 1 and bounces off sides E, N, W, E, S, and W in that order, then drops into the pocket at corner 3. The trajectory is shown below.

The first line contains the number of test cases T. Each of the following test cases is given on its own line as two integers p and q (1≤p,q≤100); the quotient p/q is the slope of the line along which the ball leaves corner 1.
For each test case, print two lines. On the first line, print the number of sides the ball bounces off. On the second line, print the sequence of sides it bounces off followed by the number of the corner where it drops into a pocket, all separated by single spaces; when the ball bounces off no side, this line contains only the corner number. If the ball can never reach a corner, print −1 on the first line instead.