def lscan; gets.split.map(&:to_i); end gets.to_i.times do n = gets.to_i aa = lscan sum = aa.reduce(:+) h = sum/3 if h*3 != sum puts 'No' next end if aa.max <= h puts 'Yes' else puts 'No' end end