// Arup Guha
// 1/18/2017
// Solution to 2014 NAQ Problem K: Yikes - Bikes!

import java.util.*;

public class yikes {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=0; loop<numCases; loop++) {

			// Get input data.
			double maxSpeed = stdin.nextDouble();
			double cycleSpeed = stdin.nextDouble();
			double initD = stdin.nextDouble();
			double startT = stdin.nextDouble();

			// If we keep the bikes stationary, this is where Max is when he starts crossing.
			// So Max is walking a diagonal...
			double x = startT*cycleSpeed;

			// This is strange, but it's the ratio Max is moving left to up. (He is walking up the street.)
			double flipSlope = cycleSpeed/maxSpeed;

			// Get vector of Max's movement and both perpendiculars.
			pt vect = new pt(cycleSpeed, maxSpeed);
			pt[] perp = vect.getUnitPerp();

			// Point where center of Max is when he starts walking.
			pt startPt = new pt(x, -.5);

			// These two points are the "left and right" ends we actually care about.
			pt slow = startPt.add(perp[1].mult(.5));
			pt fast = startPt.add(perp[0].mult(.5));

			// Find the intersections between the slow and fast sides of Max with y = 5, where the bikes are.
			double xSlow = solve(slow, flipSlope);
			double xFast = solve(fast, flipSlope);

			// He beats the first bike!
			if (xFast < initD)
				System.out.println("Max beats the first bicycle");

			// He comes after they all go.
			else if (xSlow > initD + 38)
				System.out.println("Max crosses safely after bicycle 10");

			// Bad time to cross, let's see if he made it!
			else {

				// x values relative to first bike.
				double relXFast = xFast - initD;
				double relXSlow = xSlow - initD;

				// Figure out which bike we get to (0 based) and how much we have leftover.
				int bkNum = (int)(relXSlow/4);
				double left = relXSlow - 4*bkNum;

				// In this case, we hit this bike, right when we cross.
				if (left < 2 + 1e-9)
					System.out.println("Collision with bicycle "+(bkNum+1));

				// In this case, we go after bike bkNum+1 but before bkNum+2 comes.
				else if (left + (relXFast - relXSlow) < 4 + 1e-9)
					System.out.println("Max crosses safely after bicycle "+(bkNum+1));

				// Otherwise, we run into the next bike first.
				else
					System.out.println("Collision with bicycle "+(bkNum+2));
			}
		}
	}

	// Given we start at myPt and our slope of movement is flipSlope, returns where this point intersects y = 5.
	public static double solve(pt myPt, double flipSlope) {
		double dy = 5 - myPt.y;
		return myPt.x + dy*flipSlope;
	}
}

// Standard class to manage 2D vector geometry. It does both pts and vectors.
class pt {

	public double x;
	public double y;

	public pt(double myx, double myy) {
		x = myx;
		y = myy;
	}

	public pt mult(double c) {
		return new pt(c*x, c*y);
	}

	public pt add(pt other) {
		return new pt(x+other.x, y+other.y);
	}

	public double mag() {
		return Math.sqrt(x*x+y*y);
	}

	public pt midpt(pt other) {
		return new pt((x+other.x)/2, (y+other.y)/2);
	}

	public pt getVector(pt other) {
		return new pt(other.x-x, other.y-y);
	}

	// Returns both vectors perpendicular to this as unit vectors.
	public pt[] getUnitPerp() {
		double div = mag();
		pt[] res = new pt[2];
		res[0] = new pt(this.y/div, -this.x/div);
		res[1] = new pt(-this.y/div, this.x/div);
		return res;
	}

	public double dist(pt other) {
		return Math.sqrt((x-other.x)*(x-other.x) + (y-other.y)*(y-other.y) );
	}
}