from collections import defaultdict
def divisor(b):
  lst = []
  init = 2
  while b > 1:
    for i in range(init, int(b ** (1 / 2)) + 1):
      if b % 2 == 0:
        lst.append(i)
        lst.append(b // i)
        b //= i
        init = i
    else:
      break
  return set(lst)
def main():
  t = int(input())
  for _ in range(t):
    a, b, c, d = map(int, input().split())
    if (a < b or d < b):
      print("No")
      continue
    if (c >= b):
      print("Yes")
      continue
  
    a %= b
    if a > c:
      print("No")
      continue
    d %= b
    lst = defaultdict(bool)
    while True:
      a %= b
      if a > c:
        print("No")
        break
      if lst[a]:
        print("Yes")
        break
      lst[a] = True
      a += d
main()