atcoder#ABC278C. [ABC278C] FF
[ABC278C] FF
Score : points
Problem Statement
Takahashi runs an SNS "Twidai," which has users from user through user . In Twidai, users can follow or unfollow other users.
operations have been performed since Twidai was launched. The -th operation is represented by three integers , , and , whose meanings are as follows:
- If : it means that user follows user . If user is already following user at the time of this operation, it does not make any change.
- If : it means that user unfollows user . If user is not following user at the time of this operation, it does not make any change.
- If : it means that you are asked to determine if users and are following each other. You need to print
Yes
if user is following user and user is following user , andNo
otherwise.
When the service was launched, no users were following any users.
Print the correct answers for all operations such that in ascending order of .
Constraints
- There exists such that .
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines, where is the number of 's such that . The -th line should contain the answer to the -th operation such that .
3 9
1 1 2
3 1 2
1 2 1
3 1 2
1 2 3
1 3 2
3 1 3
2 1 2
3 1 2
No
Yes
No
No
Twidai has three users. The nine operations are as follows.
- User follows user . No other users are following or followed by any users.
- Determine if users and are following each other. User is following user , but user is not following user , so
No
is the correct answer to this operation. - User follows user .
- Determine if users and are following each other. User is following user , and user is following user , so
Yes
is the correct answer to this operation. - User follows user .
- User follows user .
- Determine if users and are following each other. User is not following user , and user is not following user , so
No
is the correct answer to this operation. - User unfollows user .
- Determine if users and are following each other. User is following user , but user is not following user , so
No
is the correct answer to this operation.
2 8
1 1 2
1 2 1
3 1 2
1 1 2
1 1 2
1 1 2
2 1 2
3 1 2
Yes
No
A user may follow the same user multiple times.
10 30
3 1 6
3 5 4
1 6 1
3 1 7
3 8 4
1 1 6
2 4 3
1 6 5
1 5 6
1 1 8
1 8 1
2 3 10
1 7 6
3 5 6
1 6 7
3 6 7
1 9 5
3 8 6
3 3 8
2 6 9
1 7 1
3 10 8
2 9 2
1 10 9
2 6 10
2 6 8
3 1 6
3 1 8
2 8 5
1 9 10
No
No
No
No
Yes
Yes
No
No
No
Yes
Yes