#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

int C[2][9];


void solve() {
  int geits = 0;
  int cnt = 0;
  sort(C[0], C[1]);
  do {
    int g, j;
    g = j = 0;
    for(int i = 0; i < 9; ++i) {
      if(C[0][i] > C[1][i]) g += C[0][i] + C[1][i];
      else                  j += C[0][i] + C[1][i];
    }
    if(g > j) ++geits;
    ++cnt;
  } while(next_permutation(C[0], C[1]));

  double tmp = (double)geits/cnt;
  printf("%.5f %.5f\n", tmp, 1-tmp);
}

int main() {
  int N;
  cin >> N;
  for(int t = 0; t < N; ++t) {
    for(int i = 0; i < 2; ++i) {
      for(int j = 0; j < 9; ++j) {
	cin >> C[i][j];
      }
    }
    solve();
  }
}