import Control.Monad
import Data.Maybe
import qualified Data.Set as S
import Debug.Trace

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    qs <- replicateM n (map read . words <$> getLine) :: IO [[Int]]
    -- mapM_ query' qs
    mapM_ (putStrLn . (\f->if f then "Yes" else "No") . (\[a,b,c,d] -> let
        sa = mod (mod a b + d) b - mod a b
        in f a b c d
        )) qs

f a b c d
    | a < b     = False
    | sa == 1   = False
    | otherwise = f' a b c d sa S.empty
    where
    sa = mod (mod a b + d) b - mod a b

f' a b c d sa already
    | a < b                = False
    | c < a && a < b       = False
    | isNothing a''        = False
    | a `S.member` already = True
    | otherwise            = f' (fromJust a'') b c d sa already'
    where
    a'       = a `mod` b
    a''      = case (mod a b + d < b, sa /= 0) of
                (True, _)      -> Nothing
                (False, True)  -> Just $ mod (a' + sa * div (c-a') sa) b + d
                (False, False) -> Just $ a' + d

    already' = a `S.insert` already