#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N;
  cin >> N;
  while(N--){
    int G[9], J[9];
    for(int i = 0; i < 9; i++) cin >> G[i];
    for(int i = 0; i < 9; i++) cin >> J[i];
    sort(J, J + 9);
    int gwin = 0, jwin = 0;
    int cnt = 0;
    do {
      cnt++;
      int gscore = 0, jscore = 0;
      for(int i = 0; i < 9; i++){
	if(G[i] > J[i]) gscore += G[i] + J[i];
	else if(G[i] < J[i]) jscore += G[i] + J[i];
      }
      if(gscore > jscore) gwin++;
      else if(gscore < jscore) jwin++;
    }while(next_permutation(J, J + 9));
    printf("%.5f %.5f\n", (double)gwin / cnt, (double)jwin / cnt);
  }
  return 0;
}