Rar is building a new system, dubbed the Cats Communication System (CCS). This horribly inefficient system utilises cats to help transfer information. In this system, there are N cats lined up in a line from cat 0 to cat N-1. If a message needs to be transferred from, say, cat 2 to cat 7, cat 2 will pass on the message to cat 3, to cat 4... and so on, until it reaches cat 7. Sounds simple, right?
However, there is a problem. As everyone knows, cats LOVE sleeping. Some of these cats tend to fall asleep on the job. Say, if cat 3 falls asleep, the message from cat 2 to cat 7 will not be able to be transmitted. As such, given a list of "SLEEP" and "WAKE" events, as well as "TRANSMIT" requests in between, Rar wants you to check if each of these "TRANSMIT" requests will pass. All cats start out awake.
The format of the events will be as follows:
There will be a total of Q events. Please output a "YES" on a line for each successful transmission request and "NO" on a line for each unsuccessful transmission request, in order of the input.
8 8 TRANSMIT 2 7 SLEEP 6 TRANSMIT 1 7 TRANSMIT 1 5 SLEEP 4 TRANSMIT 1 3 WAKE 4 TRANSMIT 1 5
YES NO YES YES YES