atcoder#ABC292B. [ABC292B] Yellow and Red Card

[ABC292B] Yellow and Red Card

Score : 200200 points

Problem Statement

NN players numbered 11 to NN will play a soccer game. When a player commits an offense, that player will receive a yellow card or a red card. A player who satisfies one of the following conditions will be removed from the game.

  • Accumulates two yellow cards.
  • Receives a red card.

Once a player is removed, that player will no longer receive any cards.

You will watch this game. Initially, the players have not received any cards. There will be QQ events. Correctly answer the questions asked in the events. There are three kinds of events, which are given in the format c x from the input, where cc is 11, 22, or 33. The events are as follows.

  • 1 x: Player xx receives a yellow card.
  • 2 x: Player xx receives a red card.
  • 3 x: You are asked whether player xx has been removed from the game. Answer Yes or No.

Constraints

  • 1N1001 \leq N \leq 100
  • 1Q1001 \leq Q \leq 100
  • 1xN1 \leq x \leq N in all events.
  • There is at least one event of the third kind.
  • A player who has been removed will no longer receive any cards.
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format, where eventi\text{event}_i denotes the ii-th event.

NN QQ

event1\text{event}_1

event2\text{event}_2

\vdots

eventQ\text{event}_Q

Each event is in one of the following formats:

1 xx

2 xx

3 xx

Output

Print XX lines, where XX is the number of events of the third kind in the input. The ii-th line should contain Yes if, for the ii-th event of the third kind, player xx has been removed from the game, and No otherwise.

3 9
3 1
3 2
1 2
2 1
3 1
3 2
1 2
3 2
3 3
No
No
Yes
No
Yes
No

Here are all the events in chronological order.

In the 11-st event, you are asked whether player 11 has been removed from the game. Player 11 has not been removed, so you should print No. In the 22-nd event, you are asked whether player 22 has been removed from the game. Player 22 has not been removed, so you should print No. In the 33-rd event, player 22 receives a yellow card. In the 44-th event, player 11 receives a red card and is removed from the game. In the 55-th event, you are asked whether player 11 has been removed from the game. Player 11 has been removed, so you should print Yes. In the 66-th event, you are asked whether player 22 has been removed from the game. Player 22 has not been removed, so you should print No. In the 77-th event, player 22 receives a yellow card and is removed from the game. In the 88-th event, you are asked whether player 22 has been removed from the game. Player 22 has been removed, so you should print Yes.
In the 99-th event, you are asked whether player 33 has been removed from the game. Player 33 has not been removed, so you should print No.