| XXII Open Cup, Grand Prix of Daejeon |
|---|
| Finished |
There are two multisets $$$U$$$ and $$$V$$$ that contain two-dimensional points with integer coordinates.
We will define the following function $$$D(U, V)$$$ for a pair of multisets:
In the beginning, both $$$U$$$ and $$$V$$$ are empty. Process $$$Q$$$ queries of the following form:
When deleting a point, if there are multiple points at the given coordinates, you should delete only one of them. It is guaranteed that the given point exists in the given multiset at the time of each deletion.
Your task is to process the queries. After each query, print the value $$$D(U, V)$$$.
The first line contains a single integer $$$Q$$$ ($$$1 \le Q \le 250\,000$$$).
Each of the next $$$Q$$$ lines contains a query in the form described above. Constraints for both types of queries: $$$s \in \{1, 2\}$$$, $$$0 \le x, y \le 250\,000$$$.
Output $$$Q$$$ lines. Each line should contain the value $$$D(U, V)$$$ after the corresponding query.
6 1 1 100 100 1 2 30 130 1 1 120 170 2 1 100 100 1 2 70 100 2 1 120 170
-1 230 230 300 270 -1
| Name |
|---|


