Given a set of N line segments, you need to find all the intersection points of all the horizontal line segments with all the vertical line segments.Don't consider the coincident endpoints as intersections.
Input:
First line consists of N denoting the number of line segments.
Following N lines consist of x1,y1,x2,y2 each where (x1,y1) represents the starting point of line segment and (x2,y2) represents the ending point of line segment.
The line segments would either be horizontal or vertical.
Output:
Print all the intersection points as asked in the question in a separate line in sorted order.The intersection point is represented as (x,y) with space between them.See the sample output for clarity.
Constraints:
1≤N≤103
For horizontal line:
1≤x1 < x2≤106
1≤y1 = y2≤106
For vertical line:
1≤x1 = x2≤106
1≤y1 < y2≤106
The intersections are (2,2) and (3,2)