module Int64Set = Set.Make (Int64)

let rec solve aset a b c d =
  let ( + ) = Int64.add in
  let ( - ) = Int64.sub in
  let ( mod ) = Int64.rem in
  if a < b then "No"
  else if Int64Set.mem a aset then "Yes"
  else if a - b <= c then
    if d = b then "Yes"
    else if d < b then "No"
    else solve (Int64Set.add a aset) (d + c - (c + b - a) mod (d - b)) b c d
  else
    solve (Int64Set.add a aset) (c + if (a - c) mod b = 0L then b else (a - c) mod b) b c d
let solve = solve Int64Set.empty

let () = Scanf.scanf "%d\n" @@ fun t ->
  for i = 0 to t - 1 do
    Scanf.scanf "%d %d %d %d\n" @@ fun a b c d ->
      print_endline @@
      solve (Int64.of_int a) (Int64.of_int b) (Int64.of_int c) (Int64.of_int d)
  done

