#include <bits/stdc++.h>
typedef long long ll;
struct Rec {
    ll x1, y1, x2, y2;
    ll black() {
        if (x1 > x2 || y1 > y2) return 0;
        ll buf = (x2 - x1 + 1) * (y2 - y1 + 1);
        return buf / 2 + ((x1 + y1) & 1 && (buf & 1));
    }
    ll white() {
        if (x1 > x2 || y1 > y2) return 0;
        return (x2 - x1 + 1) * (y2 - y1 + 1) - black();
    }
    Rec inter(const Rec &tmp) const {
        Rec ret;
        ret.x1 = std::max(x1, tmp.x1), ret.x2 = std::min(x2, tmp.x2);
        ret.y1 = std::max(y1, tmp.y1), ret.y2 = std::min(y2, tmp.y2);
        return ret;
    }
} rec[4];
int main() {
    int _, n, m, x1, y1, x2, y2;
    for (scanf("%d", &_); _; _--) {
        scanf("%d%d", &n, &m);
        rec[0] = {1, 1, n, m};
        for (int i = 1; i <= 2; i++) {
            scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
            rec[i] = {x1, y1, x2, y2};
        }
        ll white = rec[0].white(), black = rec[0].black();
        rec[3] = rec[1].inter(rec[2]);
        white += rec[1].black() - rec[3].black();
        black -= rec[1].black() - rec[3].black();
        black += rec[2].white();
        white -= rec[2].white();
        printf("%lld %lld\n", white, black);
    }
    return 0;
}