n,m=gets.split.map &:to_i h=Hash.new{|h,k| h[k]=[]} m.times{ a,b=gets.split.map &:to_i h[b]<