t = gets.to_i
answers = []


t.times do
  a, b, c, d = gets.split.map(&:to_i)

  forever = false
  history = {a => true}

  while a >= b
    a -= b
    if c < a
      a -= (a - c) / b * b
      a -= b if c < a
      break if a < 0
      p [a, c]
    end
    a += d

    if history[a]
      forever = true
      break
    else
      history[a] = true
    end
  end
  answers << (forever ? 'Yes' : 'No')
end

answers.each{|answer| puts answer}