import java.io.*; import java.util.*; public class JC { public static final double PI = 3.14159; public static void main(String [] args) { double [] front = new double[3]; double [] back = new double[9]; double diam, target; int ncases = 0; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line =""; try { line = in.readLine(); } catch (Exception e) {}; ncases = Integer.parseInt(line); for(int icases=1; icases<=ncases; icases++) { try { line = in.readLine(); } catch (Exception e) {}; StringTokenizer str = new StringTokenizer(line); for(int i=0; i<3; i++) front[i] = Integer.parseInt(str.nextToken()); for(int i=0; i<9; i++) back[i] = Integer.parseInt(str.nextToken()); diam = Integer.parseInt(str.nextToken()); target = Integer.parseInt(str.nextToken()); diam *= PI; double closest = target; int f=10000, b=10000; double size = 1; for(int i=0; i<3; i++) { for(int j=0; j<9; j++) { double temp = Math.abs(target - diam*front[i]/back[j]); if (Math.abs(temp-closest) < 0.000001 && front[i] < f) { f = (int)front[i]; b = (int)back[j]; size = diam*front[i]/back[j]; closest = temp; } else if (temp < closest) { f = (int)front[i]; b = (int)back[j]; size = diam*front[i]/back[j]; closest = temp; } } } int intsize = (int)(1000*size + 0.5); size = intsize/1000.0; System.out.print("A gear selection of " + f + '/' + b); System.out.print(" produces a gear size of " + size); if (intsize % 1000 == 0) System.out.print(".000"); else if (intsize % 100 == 0) System.out.print("00"); else if (intsize % 10 == 0) System.out.print("0"); System.out.println("."); if (icases != ncases) System.out.println(); } } }