T = gets.to_i T.times do n, m = gets.split.map(&:to_i) counter = Array.new(n, 0) m.times do u, v = gets.split.map(&:to_i) counter[u - 1] += 1 counter[v - 1] += 1 end if counter.size != counter.uniq.size puts 'Yes' else puts 'No' end end