Given the latitude and longitude of two cities, find the most northerly latitude reached on the Great Circle Route between the cities. Print "undefined" if there is no unique answer.
The first line of input contains N, the number of test cases. N lines follow, one for each case, containing the latitude and longitude of the two cities, in degrees, minutes, and direction. [A minute is 1/60 degree; Points on the equator have latitude denoted 0,0N (not 0,0S); points on the poles have longitude denoted 0,0W; points with 180 degrees longitude are denoted 180,0W (not 180,0E).]
For each case your program should produce one line of output giving the most northerly latitude reached, in the given format. Round your answer to the nearest minute.
3 50,13N 45,10W 75,0N 44,50E 50,13N 90,10W 75,0N 89,50E 10,0N 129,30E 10,0S 50,30W
75,41N 90,0N undefined