module Main where

import Control.Applicative
import Control.Exception (assert)
import Control.Monad

data Test = Test Integer Integer Integer Integer
          deriving (Show, Eq)
data Result = Yes | No
            deriving (Show, Eq)

solve :: Test -> Result
solve (Test a b c d) | d < b = No
                     | a < b = No
                     | c >= b = Yes
                     | k1 < n && a' + k1 * g > c = No
                     | a' + k2 * g < b && a' + k2 * g > c = No
                     | a' + k2 * g >= b && a' + k2 * g > b + c = No
                     | otherwise = Yes
    where a' = a `mod` b
          g = b `gcd` d
          n = b `div` g
          k1 = (b - 1 - a') `div` g
          k2 = n - 1
          -- (a' + k * g) mod b <= c, where k in [0, n).
          -- For all k: k * g < b, a' < b. Therefore, a' + k * g < 2 * b
          -- a' + k * g < b => a' + k * g + 1 <= b => k <= (b - 1 - a') `div` g

tests = [Test 9 7 5 9,
         Test 9 7 6 9,
         Test 14 10 7 12,
         Test 14 10 8 12,
         Test 14 10 9 12,
         Test 14 10 7 11,
         Test 14 10 8 11,
         Test 14 10 9 11,
         Test 9 10 5 10,
         Test 10 10 5 10,
         Test 11 10 5 10,
         Test 16 10 5 10,
         Test 1000000000000000000 17 14 999999999999999985,
         Test 1000000000000000000 17 15 999999999999999985] :: [Test]

main :: IO ()
main = do
  numTests <- read <$> getLine
  replicateM_ numTests $ do
         [a, b, c, d] <- map read . words <$> getLine
         print $ solve (Test a b c d)
