n,m = gets.split.map(&:to_i) x = n.times.map{[]} m.times{ a,b=gets.split.map(&:to_i) at=a x[a]<