TOJ3777
#include<iostream>
#include<cstdio>#include<cmath>
#include<cstring>
using namespace std;
int a,b,c,d,e,f;
float y(float x)
{
return max(a*x*x+b*x+c,d*x*x+e*x+f);
}
int main()
{
int n;scanf("%d",&n);
for(int t=1;t<=n;t++)
{
scanf("%d%d%d",&a,&b,&c);
scanf("%d%d%d",&d,&e,&f);
float l=0,r=1000;
while(r-l>0.0000001)
{
float mid1=l+(r-l)/3;
float mid2=r-(r-l)/3;
if(y(mid1)<y(mid2))r=mid2;
else l=mid1;
}
float ans=y(l);
printf("%.4f\n",ans);
}
return 0;
}