#include <iostream>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)

const int N = 9;

int va[10];
int vb[10];

int main(){
	cout.setf(ios::fixed);
	cout.precision(8);
	int T;
	cin >> T;
	while(T--){
		rep(i, N) cin >> va[i];
		rep(i, N) cin >> vb[i];
		int acnt = 0;
		int bcnt = 0;
		sort(vb, vb+N);
		do{
			int a = 0, b = 0;
			rep(i, 9){
				if(va[i] > vb[i]) a += va[i] + vb[i];
				else b += va[i] + vb[i];
			}
			acnt += (a > b);
			bcnt += (b > a);
		}while(next_permutation(vb, vb+N));
		cout << acnt/362880. << ' ' << bcnt/362880. << endl;
	}

	return 0;
}