There's a hidden treasure in a castle. There are guards protecting the treasure. But the guards are not very sincere. They sometimes go outside the castle and walk around. Unfortunately, there's a thief waiting right outside the castle. The thief can only steal the treasure when there are less than guards inside the castle. Given the information about when the guards went outside and when they came back inside, you need to tell whether the thief successfully stole the treasure. Note that, in the beginning, all guards were inside.
The first line contains two integers and — number of guards, and number of activities respectively.
Each of the next lines contains a string. The string is either “out” (one of the guards went outside) or “in” (one of the guards came back inside). It is guaranteed that at least one guard was outside before any “in” string occurs in the input, and at least one guard was inside before any “out“ string.
Print YES if the thief successfully stole the treasure, otherwise print NO.
Input | Output |
---|---|
5 2 out out | YES |