output_description: Print T lines. The i-th line should contain `Yes` if Snuke can buy apple juice
  indefinitely in the i-th query; `No` otherwise.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      T
      A_1 B_1 C_1 D_1
      A_2 B_2 C_2 D_2
      :
      A_T B_T C_T D_T
      
  
  In the i-th query, A = A_i, B = B_i, C = C_i, D = D_i.
attempt: import sys
  
  iT = int(input())
  aR = [[int(x) for x in sLine.split()] for sLine in sys.stdin.readlines()]
  # わからんから解説見た。解説見たけどgcdの下りが自分で導出できんかったのでとりあえ
  ずバカループでなんとかしてみた。これで通るかな。
  
  
  def f調1(iA, iB, iC, iD):
      if iA < iB or iD < iB:
          return False
      if iC >= iB:
          return True
      iJ = iA % iB
      iK = iD % iB
      i = 1
      while True:
          j = iJ + i * iK
          if iB <= j:
              return True
          else:
              if iC < j:
                  return False
          if iK == 0:
              return True
          i += 1
      return True
  
  
  for eR in aR:
      if f調1(*eR):
          print("Yes")
      else:
          print("No")
  
problem_description: Statement
  
  Ringo Mart, a convenience store, sells apple juice.
  
  On the opening day of Ringo Mart, there were A cans of juice in stock in the
  morning. Snuke buys B cans of juice here every day in the daytime. Then, the
  manager checks the number of cans of juice remaining in stock every night. If
  there are C or less cans, D new cans will be added to the stock by the next
  morning.
  
  Determine if Snuke can buy juice indefinitely, that is, there is always B or
  more cans of juice in stock when he attempts to buy them. Nobody besides Snuke
  buy juice at this store.
  
  Note that each test case in this problem consists of T queries.
samples: [{"input": "14\n    9 7 5 9\n    9 7 6 9\n    14 10 7 12\n    14 10 8 12\n    14 10 9 12\n    14 10 7 11\n    14 10 8 11\n    14 10 9 11\n    9 10 5 10\n    10 10 5 10\n    11 10 5 10\n    16 10 5 10\n    1000000000000000000 17 14 999999999999999985\n    1000000000000000000 17 15 999999999999999985", "output": "No\n    Yes\n    No\n    Yes\n    Yes\n    No\n    No\n    Yes\n    No\n    Yes\n    Yes\n    No\n    No\n    Yes\n    \n\nIn the first query, the number of cans of juice in stock changes as follows:\n(D represents daytime and N represents night.)\n\n9 \u2192D 2 \u2192N 11 \u2192D 4 \u2192N 13 \u2192D 6 \u2192N 6 \u2192D x\n\nIn the second query, the number of cans of juice in stock changes as follows:\n\n9 \u2192D 2 \u2192N 11 \u2192D 4 \u2192N 13 \u2192D 6 \u2192N 15 \u2192D 8 \u2192N 8 \u2192D 1 \u2192N 10 \u2192D 3 \u2192N 12 \u2192D 5 \u2192N 14\n\u2192D 7 \u2192N 7 \u2192D 0 \u2192N 9 \u2192D 2 \u2192N 11 \u2192D \u2026\n\nand so on, thus Snuke can buy juice indefinitely.\n\n* * *"}, {"input": "24\n    1 2 3 4\n    1 2 4 3\n    1 3 2 4\n    1 3 4 2\n    1 4 2 3\n    1 4 3 2\n    2 1 3 4\n    2 1 4 3\n    2 3 1 4\n    2 3 4 1\n    2 4 1 3\n    2 4 3 1\n    3 1 2 4\n    3 1 4 2\n    3 2 1 4\n    3 2 4 1\n    3 4 1 2\n    3 4 2 1\n    4 1 2 3\n    4 1 3 2\n    4 2 1 3\n    4 2 3 1\n    4 3 1 2\n    4 3 2 1", "output": "No\n    No\n    No\n    No\n    No\n    No\n    Yes\n    Yes\n    No\n    No\n    No\n    No\n    Yes\n    Yes\n    Yes\n    No\n    No\n    No\n    Yes\n    Yes\n    Yes\n    No\n    No\n    No"}]