406187: GYM102307 A Amazon
Description
Amazon has grown so much these days, it has decided to build its own subway lines to be able to supply the demand of its products. To maximize efficiency, every line is completely straight. As Jeff Bezos is the richest man on the planet, every subway line is large enough to be considered infinite on a 2D representation since good old Jeff will pay as much as necessary to cover all the planet.
Such long subway lines come with a catch: to be able to move products from one line to the other, the intersections must be strong enough to handle the weight of the cargo which is moved. After thorough research amazon scientists have concluded that an intersection is strong enough only when its subway lines form a right angle.
The engineering team has gathered pairs of locations which typically ship products between each other, for each pair the team wants to build a subway line. The team also wants to build as much strong intersections as possible. Note that is possible that more than one pair of locations may share the same subway line.
How many intersections will be built? The team wants you to help with this problem.
InputThe first line contains the number of test cases $$$T$$$ $$$(1 \leq T \leq 100)$$$.
Each test case starts with an integer $$$n$$$ $$$(1 \leq n \leq 10^5)$$$ which denotes the number of location pairs, next there will be $$$n$$$ lines with four integers $$$x_1, y_1, x_2, y_2$$$ where $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$ are a location pair $$$(-2*10^4 \leq x_1, y_1, x_2, y_2 \leq 2*10^4)$$$.
OutputFor each test case print the number of intersections to build.
ExampleInput3 3 -3 2 2 2 3 1 3 -3 -3 -3 -1 -3 3 2 -2 -4 7 0 -2 6 2 4 -2 0 0 2 0 -1 -6 1 2 5 -3 0Output
2 1 0