Many years later, as he faced the Nowcoder Multi-University Training Contest, ACMer NIO was to remember that distant afternoon when his coach took him to count fish.
In a famous fish-counting problem in 2019, OIer NIO was asked to count the number of fish in 2D space. Unfortunately, the characteristics of fish were too complex, making counting them an almost impossible task. So let's look at this simplified fish-counting problem.
In this problem, NIO is given an infinite grid graph. And the god of fish will perform
mmm operations on it. Assuming the coordinates of the bottom left corner of the grid graph are
(0,0)(0,0)(0,0), there are two types of operations:
-
1 x1 y1 x2 y21\ x_1\ y_1\ x_2\ y_21 x1 y1 x2 y2 : Draw a segment between (x1,y1)(x_1,y_1)(x1,y1) and (x2,y2)(x_2,y_2)(x2,y2). It is guaranteed that x1+y1=x2+y2x_1+y_1=x_2+y_2x1+y1=x2+y2, and the drawn segments do not overlap with the existing ones.
-
2 x1 y1 x2 y22\ x_1\ y_1\ x_2\ y_22 x1 y1 x2 y2 : Erase a segment between (x1,y1)(x_1,y_1)(x1,y1) and (x2,y2)(x_2,y_2)(x2,y2). Still, x1+y1=x2+y2x_1+y_1=x_2+y_2x1+y1=x2+y2, and the segment alrealy exists in the grid graph.
After each operation, NIO needs to calculate the number of fish in this grid. In this problem, a fish is defined as a shape that satisfies the following rules.
-
It consists of a square and an equilateral right triangle, and the triangle's right-angle vertex coincides with one vertex of the square.
-
The length of the right-angle side of the triangle is equal to the square's side length.

Note that the original segments of the grid graph can also be part of a fish.