$==1e3;map$G-=$G>=$_&&$_,($=/=5-<3 >)x$_ for<>=~/\d+/g,$G=$&;print$G?NO:YES