Time limit: 4 seconds
Memory limit: 256 MB
Milad and Parsa, who were left behind after reaching the final stage of CodeCup 3, their eyes and ears were opened and they started thinking about making money. To earn money, they first thought of building a tower; But after they saw that no one has solved the question of building a tower from the Quera competition number 2, they realized that building a tower is a difficult task and they thought of building a bridge to do something simpler!

Milad and Parsa went to the Atlantic Ocean and want to connect the Shakarabad archipelagos during a big bridge construction project! in Shakrabad
t
There are t archipelagos to be connected; That is, from each of the islands of an archipelago, it should be possible to go to all the islands of that archipelago using the built bridges. These archipelagos are assumed to be completely independent of each other and each one must be connected separately. Each of these archipelagos includes a number of islands, each island in the shape of a rectangle on the map. The rectangles representing the islands are separate from each other and do not have a common area with each other, although they can share a side. Also, the sides of these rectangles are parallel to the equatorial and meridian axes of origin (coordinate axes!). To connect these islands, these two bridge builders, using advanced tools, can build bridges that are in line with the coordinate axes. (Two islands that share a common side are not connected and must be bridged to connect them.) Drawn bridges must not intersect each other, but the end of a bridge can be another constructed bridge. The ends of the bridges can be the sides of islands, the sea or other bridges, but it cannot pass over an island or over the side of an island completely. Also, a bridge can start from an island and end in the sea, or even a bridge can start from the sea and end in the sea!

Description of the image

Now, Milad and Parsa realized that despite all their efforts, they still ran into a programming problem and left this question for you. So, by taking the input of the map of each archipelago, say the least number of bridges that connect all the islands of this archipelago by connecting them according to the said conditions.

An example for more clarity: in the picture below there are 10 rectangular islands connected by 10 bridges, which is one of the optimal answers.

Description of the image

input
In the first line of input a number
t
t is said to represent the number of archipelagos in Shakrestan. then
t
t The description of the archipelago is given. In each of these explanations, first a number
n
n is stated to be equal to the number of islands in this archipelago. Then in each of
n
n next row, 4 numbers
x
1
x
1
​
 ,
y
1
y
1
​
 ,
x
2
x
2
​
 and
y
2
y
2
​
 It is stated that the coordinates of the 4 corners of the corresponding rectangle show the island.

The given rectangles are guaranteed to apply to the conditions in question. Note that the archipelagos are independent of each other; That is, two rectangles from two different archipelagos may share the same area, but no two rectangles have the same area in one archipelago.

1
≤
t
≤
5
1≤t≤5
1
≤
n
≤
200

000
1≤n≤200 000
∣
x
1
,
x
2
,
y
1
,
y
2
∣
≤
1
0
9
∣x
1
​
 ,x
2
​
 ,y
1
​
 ,y
2
​
 ∣≤10
9

x
1
<
x
2
x
1
​
 <x
2
​

y
1
<
y
2
y
1
​
 <y
2
​


output
at the exit
t
Print the number t that is the answer to the problem for each archipelago.

Example
Sample input
3
2
1 1 2 2
3 2 4 3
5
1 1 2 2
3 2 4 3
5 3 6 4
5 4 6 5
7 7 8 8
6
1 1 2 2
3 2 4 3
5 3 6 4
5 4 6 5
1 7 6 8
9 9 10 10
Plain text
Sample output
1
5
6                          write code in java17