var perm=[];
var flag=[];
for(var i=0;i<9;i++)flag[i]=false;
var cnt=0;
for(var i=0;i<9;i++){flag[i]=true;
for(var ii=0;ii<9;ii++){if(flag[ii])continue;flag[ii]=true;
for(var iii=0;iii<9;iii++){if(flag[iii])continue;flag[iii]=true;
for(var j=0;j<9;j++){if(flag[j])continue;flag[j]=true;
for(var jj=0;jj<9;jj++){if(flag[jj])continue;flag[jj]=true;
for(var jjj=0;jjj<9;jjj++){if(flag[jjj])continue;flag[jjj]=true;
for(var k=0;k<9;k++){if(flag[k])continue;flag[k]=true;
for(var kk=0;kk<9;kk++){if(flag[kk])continue;flag[kk]=true;
for(var kkk=0;kkk<9;kkk++){if(flag[kkk])continue;
perm[cnt]=[i,ii,iii,j,jj,jjj,k,kk,kkk];
cnt++;
}flag[kk]=false;
}flag[k]=false;
}flag[jjj]=false;
}flag[jj]=false;
}flag[j]=false;
}flag[iii]=false;
}flag[ii]=false;
}flag[i]=false;
}

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var t=arr.shift()-0;
while(t--){
   var a=arr.shift().split(" ").map(Number);
   var b=arr.shift().split(" ").map(Number);
   var A=0;
   var B=0;
   perm.forEach(function(V){
      var sumA=0;
      var sumB=0;
      V.forEach(function(v,i){
         if(a[v]>b[i])sumA+=a[v]+b[i];
         else sumB+=a[v]+b[i];
      });
      (sumA>sumB)?A++:B++;
   });
   console.log((A/perm.length).toFixed(5)+" "+(B/perm.length).toFixed(5));
}