Treasure

Amra shobai Raja
Limits 1s, 512 MB

There's a hidden treasure in a castle. There are $n$ 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 $4$ 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 $n$ guards were inside.

Input

The first line contains two integers $n$$( 4 \leq n \leq 100)$ and $m$$(0 \leq m \leq 100)$— number of guards, and number of activities respectively.

Each of the next $m$ 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.

Output

Print YES if the thief successfully stole the treasure, otherwise print NO.

Sample

InputOutput
5 2
out
out
YES

Login to submit.

Statistics

90% Solution Ratio
fakhrulsojibEarliest, 5M ago
abu_fayeemFastest, 0.0s
habib036Lightest, 5.4 kB
SabbasachiSutradharShortest, 139B
Toph uses cookies. By continuing you agree to our Cookie Policy.