#P1176. Industrial Nuclear Water
Industrial Nuclear Water
Description
Giant Kingdom creates tons of drinkable water, and will discharge the water into an ocean. The ocean can be simplified to a 3-dimensional space. Because of some magic, there are 3 surfaces, 1000|x| = y2+z2, 1000|y| = x2 + z2, 1000|z| = x2+ y2 , and water can’t pass through any of the surfaces. Baby Kingdom is worried about whether the drinkable water can reach their country. Given are two coordinates (x1, y1, z1),(x2, y2, z2) indicate the position of Giant Kingdom and the position of Baby Kingdom. Please find out weather the drinkable water can reach Baby Kingdom. It is guaranteed that both countries do not located in any of the surfaces. You need to answer T queries.
Input
First line contains one integer T (1 ≤ T ≤ 103 ).
Next T lines, the i-th line contains 6 integers x1, y1, z1, x2, y2, z2 (−109 ≤ x1, y1, z1, x2, y2, z2 ≤ 109 ), indicating the i-th query.
Output
T lines, in the i-th line print Yes if the drinkable water can reach Baby Kingdom, print No otherwise
3
1 0 0 2 0 0
1 0 0 -1 0 0
1 0 0 1 1 0
Yes
No
No
Hint
In example, query 3, the surface divide (1, 0, 0),(1, 1, 0) is 1000|y| = x2+ z2.