#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int t;
  cin >> t;
  while(t--){
    vector<int> gate(9), jack(9);
    rep(i,9)cin >> gate[i];
    rep(i,9)cin >> jack[i];

    sort(jack.begin(),jack.end());
    int win = 0, lose = 0, cnt = 0;
    do{
      cnt++;
      int G = 0, J = 0;
      rep(i,9){
	if(gate[i] > jack[i])G += gate[i] + jack[i];
	else J += gate[i] + jack[i];
      }
      if(G > J)win++;
      if(G < J)lose++;
    }while(next_permutation(jack.begin(),jack.end()));

    cout << fixed << setprecision(5) << (double)win/cnt << " " << (double)lose/cnt << endl;
  }
}