#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

constexpr int factorial(int n) {
	return n > 1 ? n * factorial(n - 1) : 1;
}

constexpr int NUMBER_OF_CARDS = 9;
constexpr int denominator = factorial(NUMBER_OF_CARDS);

void solve() {
	vector<int> gates(NUMBER_OF_CARDS), jackie(NUMBER_OF_CARDS);
	for(auto &e : gates) cin >> e;
	for(auto &e : jackie) cin >> e;

	sort(jackie.begin(), jackie.end());

	int gates_win = 0, jackie_win = 0;
	do {
		int gates_score = 0, jackie_score = 0;
		for(int i = 0; i < NUMBER_OF_CARDS; ++i) {
			(gates[i] > jackie[i] ? gates_score : jackie_score) += gates[i] + jackie[i];
		}
		if(gates_score > jackie_score) ++gates_win;
		else if(gates_score < jackie_score) ++jackie_win;
	} while(next_permutation(jackie.begin(), jackie.end()));

	cout << (double)gates_win / denominator << " " << (double)jackie_win / denominator << endl;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout.flags(ios::fixed);
	cout.precision(5);

	int t;
	cin >> t;
	while(t--) solve();

	return EXIT_SUCCESS;
}