Hammock in the Forest

After 5 hard-working days, the weekend is finally here; and a group of friends have decided to go eat at “La primavera” forest and spend the rest of the day resting, by simply lying on some hammocks. Therefore, they will have to look for an area that contains many trees, with the purpose of assembling as many hammocks as possible in a reduced space so that they are able to talk comfortably without having to yell or even getting off their hammock. In order to assemble each hammock a tree is needed for each end, without having to worry about the distance between these two since hammocks can easily adjust, and in the group of friends there are short and tall ones. The only restriction is that, since all of the hammocks have to be hung at the same height, they cannot be crossing in the space that will be used. Many hammocks can however be hung in different directions, from the same tree. The problem consists of determining if a given configuration of trees and hammocks may result in crossings and, if so, which pair of hammocks are involved in each crossing. Such a configuration includes: the coordinates (x, y) of each of the trees to be used and, for each hammock, the reference of the two trees that are used to hang it. For simplicity, the coordinates of the trees are specified with integer numbers. The figure on the left side denotes the configuration of the first test case, in which four trees are contemplated with three hammocks without crossings. The figure on the right side is the configuration of the second test case. In this case, installing hammock (3,4) would cause a cross with hammock (1,2) already installed; similarly, hammock (1,5) would cross with hammock (3,4). Input The first line contains an integer number N > 0, that denotes the number of test cases. The following N lines contain the configuration of trees and hammocks. The configuration is given by two sequences separated by a semicolon. The first sequence consists of one or more space-separated pairs (xk,yk), where (xk,yk) is the coordinate of the tree with index k ≥ 1 and is given by two integers, such that: xk,yk ≥ 0. The second sequence consists of one or more space-separated pairs (k,k′), where k, k′ denotes the indices of two trees connected by a hammock, such that: k ̸= k′ and k, k′ ≥ 1. Consider that the input will not violate any of the restrictions that have already been mentioned. Output The output consists of N lines, where each k ≤ N contains the ‘Ok’ word if in the current test case, no crossings of hammocks were found. However, if they were found it contains the phrase ‘Crossings

2/2 found:’ followed by the list of hammocks that crossed, separated by a semicolon. Each crossing is specified as follows: ‘< space > (j,j′) < space > (k,k′)’, meaning that hammock connecting trees j and j′ have crossed with hammock connecting trees k and k′. Consider that both hammocks where specified in the input, and that hammock (j,j′) was specified first. Also consider that if crossing (j, j′)(k, k′) is followed by crossing (m, m′)(n, n′) at the list, then hammock (j, j′) was specified before hammock (m, m′) in the input. Sample Input 2 (1,1) (4,2) (2,2) (5,4);(1,2) (3,4) (4,2) (1,4) (5,6) (0,1) (2,5) (6,3);(1,2) (3,4) (1,4) (1,5) (2,5) Sample Output Ok Crossings found: (1,2) (3,4); (3,4) (1,5)