Token Game

아직 제출이 없습니다시간 제한3초메모리 제한2048 MB

문제

Alice and Bob are playing a game on board which is a 2-dimensional 300×300300 \times 300 grid. The board is subdivided into cells. Each cell can be uniquely identified by two integers representing (x,y)(x,y) coordinates, each in the range from 11 to 300300.

Two tokens are on the board on distinct cells. Alice starts the game. On each player's turn, that player chooses one of the tokens, chooses one of the coordinates of the cell it's on, and reduces that coordinate by some positive amount. The moved token cannot jump over or occupy the same space as the other token. The token must also remain on the board (so both of its coordinates need to stay positive). The first player unable to make a move loses. Note that both players can move either token.

You are given the starting configuration of a number of games. For each of the games, compute the number of initial winning moves available to Alice.

입력

The first line of input contains a single integer nn (1n1051 \le n \le 10^5), which is the number of games to analyze.

Each of the next nn lines contains four integers x_1x\_1, y_1y\_1, x_2x\_2 and y_2y\_2 (1x_1,x_2,y_1,y_23001 \le x\_1,x\_2,y\_1,y\_2 \le 300, and either x_1x_2 x\_1 \ne x\_2 or y_1y_2y\_1 \ne y\_2 holds). This represents the starting configuration of one game, with the tokens at cells (x_1,y_1)(x\_1,y\_1) and (x_2,y_2)(x\_2,y\_2).

출력

Output nn lines. On each line, output a single integer, which is the number of initial winning moves available to Alice for one of the input games. Output them in the order of the input.