<>;($n,$x,$y)=sort(map{$_-=$"while$"=$m[$_];$_}split),$n?print$y-$x?NO:YES,$/:($m[$y]=$y-$x)for<>