open Scanf
open Printf

module Int = struct
  type t = int
  let compare a b = compare a b
end

module S = Set.Make(Int)

let consume c b x = if x <= c
  then x - b
  else if (x - c) mod b = 0
  then c
  else c + (x - c) mod b - b

let f a b c d = let memo = ref S.empty in
  let rec g x = if x < 0
    then printf "No\n"
    else if S.mem x !memo
    then printf "Yes\n"
    else (memo := S.add x !memo; g (consume c b (x+d)))
  in g (consume c b a)

let () = scanf "%d\n" (fun c ->
  for i = 1 to c do
    scanf "%d %d %d %d\n" f
  done)