// practice C
// 2002 ECNA ACM prgm contest

#include <iostream.h>
#include <iomanip.h>

const double PI=3.14159;

double abs(double x){
	if(x<0) return x*-1;
	else return x;
}

int main(void){
	int i,n,d,t,k,j,front,rear,f[3],r[9];
	double gear, best;

	cin>>n;

	for(i=0;i<n;i++){
		cin>>f[0]>>f[1]>>f[2];
		for(j=0;j<9;j++) cin>>r[j];

		cin>>d>>t;
		best = t*10;

		for(j=0;j<3;j++)
			for(k=0;k<9;k++){
				gear = (double) f[j]/r[k]*d*PI;
				if(abs(gear-t)<abs(best-t)){
					best=gear;
					front=f[j];
					rear=r[k];
				}
			}
		if(i!=0) cout<<endl;
		cout<<setiosflags(ios::showpoint | ios::fixed)<<setprecision(3);
		cout<<"A gear selection of "<<front<<'/'<<rear;
		cout<<" produces a gear size of "<<best<<'.'<<endl;

	}
}


