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