#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int N;
  cin>>N;
  while(N--){
    int v[9],u[9];
    REP(i,9)cin>>v[i];
    REP(i,9)cin>>u[i];
    int sum = 0;
    int win = 0;
    int win2 = 0;
    sort(v, v+9);
    do{
      int t = 0;
      REP(i,9){
        if(v[i] > u[i])t += v[i] + u[i];
        else t -= v[i] + u[i];
      }
      if(t > 0) win ++;
      if(t < 0) win2 ++;
      sum++;
    }while(next_permutation(v, v+9));
    cout<<(double)win/sum<<" "<<(double)win2/sum<<endl;
  }
  return 0;
}