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
  1000.times do
    if today_apple >= b
      if today_apple-c >= b
        today_apple -= ((today_apple-c)/b)*b
      else
        today_apple -= b
      end
      if today_apple <= c
        today_apple += d
      end
    else
      flag = false
      break
    end
  end
  if flag
    puts "Yes"
  else
    puts "No"
  end
end
