Turning Trominos
시간 제한3초메모리 제한1024 MB
L-트로미노가 첫 사분면을 자기닮음으로 타일링할 때, 주어진 칸을 덮는 트로미노의 방향을 여덟 가지 중에서 판별한다.
문제

trominos,replicated.
The -tromino is composed of three unit squares arranged as shown in part A of the illustration to the right. The -tromino is also an example of a rep-tile because four -trominos can be arranged to make a replica of itself that is twice as tall and twice as wide, as shown in B. Rep-tiles are interesting because, once they can tile themselves, they can recursively tile as much of the plane as we want, as suggested in C and D. Part C is made from four copies of B, and D is made from four copies of C. Figure 1 shows the first quadrant of the plane completely tiled by -trominos by repeating the same procedure.
For this problem, you will be given a square in the first quadrant, and your task is to find the orientation of the -tromino covering that square. The unit squares of the first quadrant are numbered in the - and -directions, as shown. The dots, in order from left to right, correspond to the first four sample inputs.

Figure 1: -trominos tiling the first quadrant.

Figure 2: -tromino orientations.
입력
The first line contains an integer , indicating the number of cases that follow. Each case consists of a single line. Each of the next lines contains two integers and , separated by a space, with , indicating a particular square in the first quadrant.
출력
For each case, output the orientation of the -tromino that covers the given square, one line per case, where the orientations are shown in Figure 2.