ccs

Problem Description

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:

  1. "WAKE x": cat x wakes up.
  2. "SLEEP x": cat x falls asleep.
  3. "TRANSMIT x y": attempt to transmit information from cat x to cat y (x ≤ y).

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.

Input

The first line of input will contain two integers, N and Q.
The next Q lines of input will contain one event as stated above.

Output

There should be one line of output for every "TRANSMIT" operation, either stating a "YES" or a "NO".

Subtasks

Subtask 1 (8%): 1 ≤ N, Q ≤ 100.
Subtask 2 (13%): 1 ≤ N, Q ≤ 1000.
Subtask 3 (17%): 1 ≤ N, Q ≤ 300000. There will only be "SLEEP" and "TRANSMIT" events.
Subtask 4 (21%): 1 ≤ N, Q ≤ 300000.
Subtask 5 (41%): 1 ≤ N ≤ 231-1. 1 ≤ Q ≤ 300000.

Sample Input

8 8
TRANSMIT 2 7
SLEEP 6
TRANSMIT 1 7
TRANSMIT 1 5
SLEEP 4
TRANSMIT 1 3
WAKE 4
TRANSMIT 1 5

Sample Output

YES
NO
YES
YES
YES

Time Limit: 1 Seconds
Memory Limit: 2048MB
Your best score: 0
Source: Dunjudge Archive

Subtask Score
1 8
2 13
3 17
4 21
5 41