t = gets.chomp.to_i
ary = []
t.times do |i|
  ary << gets.chomp.split.map(&:to_i)
end

# 10^5回回していい
# 100回処理して行けるか
ary.each do |items|
  # 1会のクエリ
  a,b,c,d = items[0],items[1],items[2],items[3]
  today_apple = a
  flag = true
  if b > d
    puts "No"
  elsif a >=b and b <= c
    puts "Yes"
  else
    stock = {}
    if (a-c)/b >= 2
      today_apple -= ((today_apple-c)/b)*b
      today_apple+=b
    end
    if d > c+b
      d -= ((d-c)/b)*b
    end
    # p [today_apple,b,c,d]
    while true
      if today_apple >= b
        if stock.has_key?(today_apple)
          break
        end
        stock[today_apple]=1
        today_apple -= b
        if today_apple <= c
          today_apple += d
        end
      else
        flag = false
        break
      end
    end
    if flag
      puts "Yes"
    else
      puts "No"
    end
  end
end
