For each operation of type $3$, output two integers seperated by space indicating the answer.
Example explanation:
After the first $5$ operations, the tree will look like this:
When we dfs the tree, we will visit nodes in the following order:
$$
1, 2, 3, 4, 5, 6
$$
For the $6$th operation, the answer is $A = \sum\limits_{i=0}^{3} first(1, i) = 1 + 2 + 3 + 5 = 11$ and $B = \max\limits_{i=0}^{3} \{first(1, i)\}$ $ = \max\{1,2,3,5\} = 5$.
For the $7$th operation, the answer is $A = 6$, $B = 6$.
After the $8$th operation, the node $3$ is removed and the new tree will look like this:
Then, for the last operation, the answer is $A = \sum\limits_{i=0}^{3} first(1, i) = 1 + 2 + 4 + 5 = 12$ and $B = \max\limits_{i=0}^{3} \{first(1, i)\}$ $ = \max\{1,2,4,5\} = 5$.