n,m=gets.split.map &:to_i r=(0..n) g=r.map{[]} m.times{u,v=gets.split.map &:to_i;g[u]<4}}}}?:YES: :NO