The "Dormi's Fone Service" is now the only telephone service provider in CCOland.
There are
There is an issue where the phone lines are faulty, and each phone line only exists for a single interval of time. Two houses can call each other at a certain time if there is a path of phone lines that starts at one of the houses and ends in the other house at that time.
We would like to process
1 x y
: Add a phone line between houses and . It is guaranteed that a phone line between houses and was never added before.2 x y
: Remove the phone line between houses and . It is guaranteed that a phone line currently exists between houses and .3 t
: Compute the number of pairs of different houses that can call each other at some time between the current query and queries ago. To be more clear, let be the state of CCOland after the -th query, where is the state of CCOland before any queries. If this is the -th query, then count the number of pairs of houses that are connected in at least one of .
Also, some test cases may be encrypted. For the test cases that are encrypted, the arguments
Input Specification
The first line of input will contain
The second line contains two space-separated integers
The next
For the
Marks Awarded | Bounds on |
Bounds on |
Encrypted? |
---|---|---|---|
3 marks | |||
2 marks | |||
4 marks | |||
2 marks | |||
4 marks | |||
5 marks | |||
5 marks |
Output Specification
For each query of type 3, output the answer to the query on a new line.
Sample Input 1
0
4 12
3 0
1 1 2
3 0
1 1 3
3 0
3 5
2 2 1
3 0
3 8
1 1 4
3 0
3 11
Sample Output 1
0
1
3
3
1
3
3
5
Explanation of Output for Sample Input 1
This test case is not encrypted.
For the
For the
For the
The
For the
For the
For the
For the
Explanation of Output for Sample Input 2
Encrypted version of sample 1.
Sample Input 2
1
4 12
3 0
1 1 2
3 0
1 0 2
3 1
3 6
2 1 2
3 3
3 9
1 2 7
3 3
3 8
Sample Output 2
0
1
3
3
1
3
3
5
Comments