{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    !n <- readLn :: IO Int
    replicateM_ n $ do
        [a,b,c,d] <- map read.words <$> getLine :: IO [Integer]
        putStrLn.bool"No""Yes"$solve a b c d

solve x0 cost c gain
    | x0 < cost = False
    | gain < cost = False
    | x1 < 0 = False
    | cost <= th = True
    | cost == gain = True
-- gain > cost > th
    | reduceToThreshold (x1 + gain) cost th == x1 = True
    | reduceToThreshold (x1 + gain) cost th < x1 = False
    | d <- reduceToThreshold (x1 + gain) cost th - x1
    , (q, r) <- (th - x1)`divMod`d
    = not $ r == 0 || (q + 1) * d + x1 < cost
  where
    th = c + 1
    x1 = reduceToThreshold x0 cost th

reduceToThreshold x0 cost th
  | x0 < th = x0
  | otherwise = th + mod (x0 - th) cost - cost
