import Control.Monad (replicateM, replicateM_)
import Data.List (find)
import Data.Maybe (fromJust)

main :: IO ()
main = do
  t <- readLn
  let
    h = do
      line <- getLine
      let
        answer = (\(a:b:c:d:_) -> if f a b c d then "Yes" else "No") . map read . words $ line
      putStrLn answer
  replicateM_ t h

getNLine :: IO [String]
getNLine = do
  n <- readLn
  replicateM n getLine

f :: Int -> Int -> Int -> Int -> Bool
f initial buy level restock
  | buy > initial = False -- 即死
  | buy > restock = False -- ジリ貧
  | buy <= level = True -- 絶対死なない
  | otherwise =
    let
      step = gcd buy restock -- mod buy で見ると、購入・補充はこのステップで動く
    in
      buy - step + initial `mod` step <= level
