// Arup Guha
// 4/7/2018
// Solution to 2018 Code Jam Qualification Problem: UFO - SMALL DATA ONLY!!!

import java.util.*;

public class Solution {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=nC; loop++) {

			double x = stdin.nextDouble();

			System.out.println("Case #"+loop+":");

			// I just rotate appropriately in one axis...
			if (x < Math.sqrt(2)) {
				double theta = Math.PI/4 - Math.acos(x/Math.sqrt(2));
				System.out.printf("%.12f %.12f %.12f\n",(.5*Math.cos(theta)),((.5*Math.sin(theta))),0.0);
				System.out.printf("%.12f %.12f %.12f\n",(-.5*Math.sin(theta)),((.5*Math.cos(theta))),0.0);
				System.out.println("0 0 0.5");
			}

		}
	}
}