#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  int g[9],j[9];
  int t,wg,wj,n;

  cin >> t;
  while(t--){
    for(int i=0;i<9;i++)cin >> g[i];
    for(int i=0;i<9;i++)cin >> j[i];
    sort(g,g+9);
    n = wg = wj = 0;

    do{
      n++;
      int sg,sj;
      sg = sj = 0;
      for(int i=0;i<9;i++){
	if(g[i] > j[i])sg += g[i] + j[i];
	else sj += g[i] + j[i];
      }
      if(sg > sj)wg++;
      if(sg < sj)wj++;
    }while(next_permutation(g,g+9));

    printf("%.5lf %.5lf\n",(double)wg/n,(double)wj/n);
  }
}