import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

void main() {
    int T; scanf("%d\n", &T);

    int[] A, B;
    void input() {
        A = readln.chomp.split(" ").map!(to!int).array;
        B = readln.chomp.split(" ").map!(to!int).array;
    }
    void solve() {
        double dfs(int x, int bit, int a, int b) {
            if (x == 9) return (a > b);
            double ret = 0;
            foreach (i; 0 .. 9) {
                if (bit & (1 << i)) continue;
                int na = a, nb = b;
                (A[x] > B[i] ? na : nb) += (A[x] + B[i]);
                ret += dfs(x + 1, bit | 1 << i, na, nb) / (x + 1);
            }
            return ret;
        }
        double a = dfs(0, 0, 0, 0);
        writefln("%.5f %.5f", a, 1.0 - a);
    }

    foreach (t; 0 .. T) {
        input; solve;
    }
}