401905: GYM100570 D TROY Query

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. TROY Querytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

De Prezer loves TROYs. A TROY is a 1018 × 1018 square and there is either  + 1 or  - 1 in each cell of this square (actually it's a grid).

There are two types of operation :

1. Multiply all numbers in a row by  - 1 .

2. Multyply all numbers in a column by  - 1 .

De Prezer has found two TROYs, the number in the j - th column of the i - th row of the first TROY is ai, j and in the second TROY is bi, j .

De Prezer also loves query, so he gives you some queries.

First of all, you don't have any information about numbers in these two TROYs. Each query, gives the values x ,y, ax, y, bx, y (that you didn't get before), and you should tell him if it is can be possible to transform the first TROY to the second one (the values in the cells that we don't know, could be the way that we can transform the first TROY to the second one) using the operations above, with the information you got so far.

Input

The first line of input contains integer n, the number of queries.

Each of the next n lines, contain 4 integers x ,y, ax, y, bx, y .

1 ≤ n ≤ 105

1 ≤ x, y ≤ 1018 and

Output

For each query, print a single string in a line, "Yes" or "No" (Without quotes).

ExamplesInput
3
829054240386762533 576622723736087196 +1 -1
659693256240999920 576622723736087196 +1 +1
395697514003384346 576622723736087196 +1 +1
Output
Yes
Yes
Yes
Input
4
1 1 +1 -1
1 2 +1 -1
2 1 +1 -1
2 2 +1 +1
Output
Yes
Yes
Yes
No

加入题单

上一题 下一题 算法标签: