// Arup Guha
// 11/1/2020
// Solution to 2020 UCF Locals Problem: Paragliders and Aircraft (Incoming!)
import java.util.*;

public class incoming {

	// Cylinder Info
	public static double low;
	public static double high;
	public static double r;
	public static pt center;
	
	// Flight Info
	public static int flightNo;
	public static pt pStart;
	public static double pAngle;
	public static double pInitAlt;
	public static double pVel;
	public static double pDeltaZ;
	public static double pDeltaX;
	public static double pDeltaY;
	
	public static void main(String[] args) {
	
		// Get cylinder.
		Scanner stdin = new Scanner(System.in);
		double x = stdin.nextDouble();
		double y = stdin.nextDouble();
		center = new pt(x,y);
		r = stdin.nextDouble();
		low = stdin.nextDouble();
		high = stdin.nextDouble();
		
		// Process flights.
		int n = stdin.nextInt();
		for (int loop=0; loop<n; loop++) {
			
			// Get flight stuff.
			flightNo = stdin.nextInt();
			x = stdin.nextDouble();
			y = stdin.nextDouble();
			pStart = new pt(x, y);
			pAngle = stdin.nextDouble()/180*Math.PI;
			pInitAlt = stdin.nextDouble();
			pVel = stdin.nextDouble();
			pDeltaZ = stdin.nextDouble();
			
			// Figure out x, y vector velocities also.
			double deltaHoriz = Math.sqrt(pVel*pVel-pDeltaZ*pDeltaZ);
			pDeltaX = deltaHoriz*Math.cos(pAngle);
			pDeltaY = deltaHoriz*Math.sin(pAngle);
			
			// Do it!
			doCase();
		}
	}
	
	public static void doCase() {
		
		// Get this out of the way.
		if (pInitAlt < low) {
			System.out.println("Flight "+flightNo+" is safe.");
			return;
		}
		
		// Update the plane, if necessary to be where it is at when it reaches the plane of the
		// top of the cylinder.
		double tAtHigh = 0;
		if (pInitAlt > high) {
			tAtHigh = (pInitAlt-high)/pDeltaZ;
			pInitAlt = high;
			pStart.x = pStart.x + tAtHigh*pDeltaX;
			pStart.y = pStart.y + tAtHigh*pDeltaY;
		}
		
		double t0 = -1, t1 = -1;
		
		// Case where plane enters at top...
		if (Math.abs(pInitAlt-high) < 1e-9) 
			if (pStart.dist(center) < r + 1e-9) 
				t0 = tAtHigh; 
			
		// Calculate where plane is when it intersects plane of bottom of cylinder.
		double tAtLow = (pInitAlt-low)/pDeltaZ;
		double xLow = pStart.x + tAtLow*pDeltaX;
		double yLow = pStart.y + tAtLow*pDeltaY;
		pt tmpBottom = new pt(xLow, yLow);
		
		// Exits cylinder at bottom, update real time if it entered at top, since I changed
		// the time for that case.
		if (tmpBottom.dist(center) < r+1e-9) t1 = tAtLow + tAtHigh;
		
		// Vertical drop, since this case messes up our quadratic.
		if (pVel-pDeltaZ < 1e-9) {
			if (t0 > -1e-9) {
				System.out.printf("Incoming! Flight %d enters at %.2f and exits at %.2f.\n", flightNo, t0, t1);				
				return;
			}
			else {
				System.out.println("Flight "+flightNo+" is safe.");
				return;				
			}
		}
			
		// Easier to have these to solve our quadratic.
		double dx = pStart.x - center.x;
		double dy = pStart.y - center.y;
			
		// Quadratic in time to solve for entry/exit into cylinder.
		double a = pDeltaX*pDeltaX + pDeltaY*pDeltaY;
		double b = 2*dx*pDeltaX+2*dy*pDeltaY;
		double c = dx*dx + dy*dy - r*r;
		double disc = b*b - 4*a*c;
			
		// No solution!
		if (disc < 1e-9) {
			System.out.println("Flight "+flightNo+" is safe.");
			return;				
		}
			
		// Get roots.
		double r1 = (-b - Math.sqrt(disc))/(2*a);
		double r2 = (-b + Math.sqrt(disc))/(2*a);
			
		// Happened in the past so wasn't in the cylinder.
		if (r1 < 0 && r2 < 0) {
			System.out.println("Flight "+flightNo+" is safe.");
			return;				
		}
			
		// Entered at the top, but exited on the side.
		if (r1 < 0 && r2 > 0 && t1 < 0) t1 = t0 + r2;

		// Valid intersections, update only if we previously didn't give these times.
		if (r1 > 0 && r2 > 0) {
			if (t0 < 0) t0 = tAtHigh + r1;
			if (t1 < 0) t1 = tAtHigh + r2;
		}
			
		// Still can be safe if t0 or t1 never got updated or t1 is too late (ie flew under the cylinder...)
		if (t0 < 0 || t1 < 0 || t1 > tAtLow+tAtHigh)
			System.out.println("Flight "+flightNo+" is safe.");
		else
			System.out.printf("Incoming! Flight %d enters at %.2f and exits at %.2f.\n", flightNo, t0, t1);
	}
}

class pt {

	public double x;
	public double y;
	
	public pt(double myx, double myy) {
		x = myx;
		y = myy;
	}
	
	public double dist(pt other) {
		return Math.sqrt( (x-other.x)*(x-other.x) + (y-other.y)*(y-other.y) );
	}
}