$\=NO;s/\S+/$=-=$b[$j++]+=$&;$=+=$b[$i++]while$=<0;$=or$\=YES/ger,$i=$j=$==777for<>;print