open Scanf
open Printf

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 rec g n x = if x < 0
                  then printf "No\n"
                  else if n < 0
                  then printf "Yes\n"
                  else g (n-1) (consume c b (x+d))
  in g (c+3) (consume c b a)

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