To seem more cultured, Max has undertaken consuming all the best media generated ever!
Currently, he has
1 i name
: Output
2 i name
: Insert
Can you help maintain Max's media list?
Constraints
Each
Subtask 1 [40%]
Subtask 2 [60%]
No additional constraints.
Note: Fast I/O might be required to fully solve this problem (e.g., BufferedReader for Java).
Input Specification
The first line will contain two integers,
The next
Output Specification
For each type
Sample Input 1
1 6
1 1 test
2 1 test
2 1 test
1 1 test
2 1 blah
1 1 pf
Sample Output 1
0
1
0
Sample Input 2
2 6
1 1 test
2 1 test
2 1 test
1 2 test
2 2 blah
1 2 blah
Sample Output 2
0
0
1
Comments