// Arup Guha
// 6/5/2014
// Solution to 2008 UCF High School Programming Contest Problem: Ali's Analog Clock

import java.util.*;
import java.io.*;

public class hands {

	public static void main(String[] args) throws IOException {

		Scanner fin = new Scanner(new File("hands.in"));

		int numCases = fin.nextInt();

		// Process each case
		for (int loop=1; loop<=numCases; loop++) {

			// Get maximum of two triangles - use doubles to avoid overflow of int.
			int ans = 0;
			for (int i=0; i<2; i++) {
				double[] sides = new double[3];
				for (int j=0; j<3; j++) sides[j] = fin.nextInt();
				ans = Math.max(ans, solve(sides));
			}

			// Print result.
			System.out.println("Pair #"+loop+" of hands requires a clock face at least "+ans+" meters wide.");
		}

		fin.close();
	}

	// Precondition: sides is length 3
	public static int solve(double[] sides) {

		Arrays.sort(sides);

		// Use law of cosides to determine angle opposite largest side.
		double maxAngle = Math.acos((sides[0]*sides[0]+sides[1]*sides[1]-sides[2]*sides[2])/(2*sides[0]*sides[1]));
		double refAngle = Math.PI - maxAngle;

		// Middle of clock - set (0,0) to be "right side" of short side and short side on x-axis, centered.
		double startX = -sides[0]/2.0;
		double startY = 0;

		// Outer pt of clock.
		double endX = sides[1]*Math.cos(refAngle);
		double endY = sides[1]*Math.sin(refAngle);

		// Distances between center and edge pt, rounded to the next integer with the .01 fudge factor and an epsilon.
		return (int)(2*Math.sqrt(Math.pow(endX-startX,2) + Math.pow(endY-startY,2)) + 1.02 - 1e-9);
	}
}