--- /dev/null
+import Control.Monad
+
+main :: IO ()
+main = do
+ line1 <- getLine
+ let numQuestions = read line1 :: Int
+ answers <- forM [1..numQuestions] $ \_ -> do
+ q <- getQuestion
+ return $ solve q
+ putStrLn $ unlines $ map showA answers
+
+getQuestion :: IO (Int, Int)
+getQuestion = do
+ line <- getLine
+ let question = map read $ words line
+ return (question !! 0, question !! 1)
+
+
+solve :: (Int, Int) -> Bool
+solve (0, 0) = True
+solve (0, _) = False
+solve (_, 0) = False
+solve (nLeft, nRight) = (a <= b * 2) && ((b - n) `mod` 3 == 0)
+ where a = max nLeft nRight
+ b = min nLeft nRight
+ n = a - b
+
+showA :: Bool -> String
+showA True = "YES"
+showA False = "NO"