A dog running into the road and knocking down a cyclist is not a rare accident. This problem looks at that moment from the dog's side. Max the dog catches a good smell, spots a tasty looking rabbit on the other side of the road, and decides to run straight across. Given the time Max starts running, decide whether he gets across safely.
The road is straight and 10 meters wide. Max runs perpendicular to the road at a constant speed of M m/s. Max's body is a circle of diameter 1 meter. Before he starts, Max stands outside the road with that circle touching the near edge, so its center is 0.5 meters outside the edge.
Every bicycle rides along the center line of the road at the same speed B m/s. Each bicycle is a segment of length 2 meters lying on that line. The gap between the rear of one bicycle and the front of the next one is 2 meters, so the fronts of two neighboring bicycles are 4 meters apart. Exactly 10 bicycles come in a row, numbered 1 to 10 from the front.
Set up coordinates like this. The point where Max wants to cross is x=0, and x grows in the direction the bicycles ride. Measure y across the road, so the edge Max stands on is y=0 and the far edge is y=10. The center line the bicycles ride on is y=5.
At t=0 the front of bicycle 1 is D meters away from Max's crossing point along the road and has not reached that point yet. So at time t the front of bicycle k is at x=−D−4(k−1)+Bt and its rear is 2 meters behind that.
Max starts running at time T, so for t≥T the center of his circle is at (0, −0.5+M(t−T)). If at any moment the circle that represents Max touches or overlaps a bicycle segment, they collide. When several collisions happen, report the first one.
If there is no collision, the gap Max goes through is read at the moment his center lies on the center line, that is at t=T+5.5/M. At that moment his circle meets the center line from x=−0.5 to x=0.5. If the front of bicycle 1 has not reached x=−0.5 yet, Max beats the first bicycle. Otherwise let k be the number of bicycles whose rear has already passed x=0.5, and Max crosses after bicycle k.
The first line has the number of test cases N (1≤N≤40).
Each test case takes four lines.
All four values are real numbers with at most three digits after the decimal point. No input is given whose verdict changes under a very small change of these values.
For each test case print one line.
Max beats the first bicycle if Max passes in front of bicycle 1 and reaches the rabbit.Max crosses safely after bicycle k if Max crosses in a gap between two bicycles or behind the last one. Put the number of that bicycle, from 1 to 10, in place of k.Collision with bicycle k if Max hits a bicycle. Put the number of that bicycle, from 1 to 10, in place of k. When several collisions happen, print the first one.