#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){
    int a, b;
    a = b = 0;
    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        int tot = 0;
        return mp(hang*lie/2, hang*lie/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x4<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){

    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        int tot = 0;
        return mp(hang*lie/2, hang*lie/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<"in "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

1000000000 1000000000
1 1 1000000000 1000000000
2384793 1209473 2384794 1209474

*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){
    //cout<<"uu "<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
    assert(x1<=x2&&y1<=y2);
    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        return mp(tot/2, tot/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<"in "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        //cout<<"fal "<<white<<" "<<black<<endl;
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

1000000000 1000000000
1 1 1000000000 1000000000
2384793 1209473 2384794 1209474

*/


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){

    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        return mp(tot/2, tot/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<"in "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        //cout<<"fal "<<white<<" "<<black<<endl;
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        if(white == 24894038125719395)
            printf("%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld", x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2);
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

1000000000 1000000000
1 1 1000000000 1000000000
2384793 1209473 2384794 1209474

*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){
    assert(x1>x2||y1<y2);
    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        return mp(tot/2, tot/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<"in "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        //cout<<"fal "<<white<<" "<<black<<endl;
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

1000000000 1000000000
1 1 1000000000 1000000000
2384793 1209473 2384794 1209474

*/


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){

    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        return mp(tot/2, tot/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<"in "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        //cout<<"fal "<<white<<" "<<black<<endl;
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        if(white == 248940381257193950){
            cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
            cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
            cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        }
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

1000000000 1000000000
1 1 1000000000 1000000000
2384793 1209473 2384794 1209474

*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){
    //cout<<"uu "<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
    assert(x1<=x2&&y1<=y2);
    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        return mp(tot/2, tot/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    a1 = a2 = b1 = b2 = 0;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<"in "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        //cout<<"fal "<<white<<" "<<black<<endl;
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

1000000000 1000000000
1 1 1000000000 1000000000
2384793 1209473 2384794 1209474

*/


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){

    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        int tot = 0;
        return mp(hang*lie/2, hang*lie/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
#define y1 deiojd
#define x1 ewh

const int inf = 0x3f3f3f3f;
const int maxn = 1e5+10;

int readint()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

ll n, m;
int x1, x2, x3, x4;
int y1, y2, y3, y4;

pair<ll, ll> cal1(int x1, int y1, int x2, int y2){
    assert(x1>x2||y1>y2);
    ll hang = y2-y1+1;
    ll lie = x2-x1+1;
    ll tot = hang*lie;
    //cout<<"cal1 "<<tot<<" "<<hang<<" "<<lie<<endl;
    if((hang&1)&&(lie&1)){
        if(x1%2==y1%2){

            return mp(tot/2+1, tot/2);
        }
        else{
            return mp(tot/2, tot/2+1);
        }
    }
    else{
        return mp(tot/2, tot/2);
    }
}

void cal(){
    bool jiao = true;
    if(x3>x2||x4<x1||y3>y2||y4<y1) {
        jiao = false;
    }
    int a1, a2, b1, b2;
    if(y3>=y1&&y3<=y2&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3>=y1&&y3<=y2&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y3, a2 = x2, b2 = y2;
        }
        else if(x4>=x1&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y3, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3<x1){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x1, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x1, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    if(y3<y1&&x3>=x1&&x3<=x2){
        if(x4>=x1&&x4<=x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x4, b2 = y2;
        }
        else if(x4>x2&&y4>y2){
            a1 = x3, b1 = y1, a2 = x2, b2 = y2;
        }
        else if(x4>=x2&&x4<=x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x4, b2 = y4;
        }
        else if(x4>x2&&y4<=y2&&y4>=y1){
            a1 = x3, b1 = y1, a2 = x2, b2 = y4;
        }
    }
    //cout<<"in "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
    pair<ll, ll> temp = cal1(1, 1, m, n);
    ll white = temp.first, black = temp.second;
    //cout<<"init "<<white<<" "<<black<<endl;
    if(jiao==false){
        //cout<<"fal "<<white<<" "<<black<<endl;
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        printf("%lld %lld\n", white, black);

    }
    else{
        temp = cal1(x1, y1, x2, y2);
        white += temp.second;
        black -= temp.second;
        //cout<<"1  "<<white<<" "<<black<<endl;
        //cout<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
        temp = cal1(a1, b1, a2, b2);
        white -= temp.second;
        black += temp.second;
        //cout<<"2  "<<white<<" "<<black<<endl;
        temp = cal1(x3, y3, x4, y4);
        white -= temp.first;
        black += temp.first;
        //cout<<"3  "<<white<<" "<<black<<endl;
        printf("%lld %lld\n", white, black);
        return ;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    int _;
    scanf("%d", &_);

    while(_--){
        scanf("%d%d", &n, &m);
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

        scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
        cal();

    }
    return 0;
}
/*
100
5 5
3 3 4 3
1000000000 1000000000
1 1 500000000 500000000
500000000 500000000 1000000000 1000000000

1000000000 1000000000
1 1 1000000000 1000000000
2384793 1209473 2384794 1209474

*/


#include <bits/stdc++.h>

using namespace std;

pair<int, int> get(long long n, long long m, bool is_white)
{
    if (n < 0 || m < 0)
        return make_pair(0, 0);

    long long nblack = (n*m)/2;
    long long nwhite = n*m - nblack;

    if (is_white)
        return make_pair(nwhite, nblack);

    return make_pair(nblack, nwhite);
}

bool intersect(long long a, long long b, long long c, long long d)
{
    if (a > c)
        return intersect(c, d, a, b);
    return b >= c;
}

void eq(pair<int, int> p, long long &a, long long &b)
{
    a = p.first;
    b = p.second;
}

int main() {

    long long n, m, t; cin >> t;
    long long x1, y1, x2, y2;
    long long x3, y3, x4, y4;
    long long nwhite, nblack;
    long long w1, b1, w2, b2;
    long long cw, cb;

    while (t--)
    {
        cin >> n >> m;
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> x3 >> y3 >> x4 >> y4;

        eq(get(n, m, true), nwhite, nblack);

        eq(get(x2 - x1 + 1, y2 - y1 + 1, ((x1+y1) % 2) == 0), w1, b1);
        eq(get(x4 - x3 + 1, y4 - y3 + 1, ((x3+y3) % 2) == 0), w2, b2);

        nblack -= b1;
        nwhite += b1;

        nwhite -= w2;
        nblack += w2;

        if (intersect(x1, x2, x3, x4) && intersect(y1, y2, y3, y4))
        {
            eq(get(min(x2, x4) - max(x1, x3) + 1, min(y2, y4) - max(y1, y3) + 1,
                   ((max(x1, x3) + max(y1, y3)) % 2) == 0), cw, cb);

            nwhite -= cb;
            nblack += cb;
        }

        cout << nwhite << ' ' << nblack << endl;
    }

}


#include <bits/stdc++.h>

using namespace std;

pair<long long, long long> get(long long n, long long m, bool is_white)
{
    if (n < 0 || m < 0)
        return make_pair(0, 0);

    long long nblack = (n*m)/2;
    long long nwhite = n*m - nblack;

    if (is_white)
        return {nwhite, nblack};

    return {nblack, nwhite};
}

bool intersect(long long a1, long long b1, long long a2, long long b2)
{
    if (a1 > a2)
        return intersect(a2, b2, a1, b1);
    return b1 >= a2;
}

void eq(pair<long long, long long> p, long long &a, long long &b)
{
    a = p.first;
    b = p.second;
}

int main() {

    long long n, m, t; cin >> t;
    long long wLeft, wBottom, wRight, wTop;
    long long bLeft, bBottom, bRight, bTop;
    long long white, black;
    long long w1, b1, w2, b2;
    long long cw, cb;

    while (t--)
    {
        cin >> n >> m;
        cin >> wLeft >> wBottom >> wRight >> wTop;
        cin >> bLeft >> bBottom >> bRight >> bTop;

        eq(get(n, m, true), white, black);

        eq(get(wRight - wLeft + 1, wTop - wBottom + 1, ((wLeft+wBottom) % 2) == 0), w1, b1);
        eq(get(bRight - bLeft + 1, bTop - bBottom + 1, ((bLeft+bBottom) % 2) == 0), w2, b2);

        black -= b1;
        white += b1;

        white -= w2;
        black += w2;

        if (intersect(wLeft, wRight, bLeft, bRight) && intersect(wBottom, wTop, bBottom, bTop))
        {
            eq(get(min(wRight, bRight) - max(wLeft, bLeft) + 1, min(wTop, bTop) - max(wBottom, bBottom) + 1,
                   ((max(wLeft, bLeft) + max(wBottom, bBottom)) % 2) == 0), cw, cb);

            white -= cb;
            black += cb;
        }

        cout << white << ' ' << black << endl;
    }

}


#include <bits/stdc++.h>

using namespace std;

pair<int, int> get(int n, int m, bool is_white)
{
    if (n < 0 || m < 0)
        return make_pair(0, 0);

    int nblack = (n*m)/2;
    int nwhite = n*m - nblack;

    if (is_white)
        return make_pair(nwhite, nblack);

    return make_pair(nblack, nwhite);
}

bool intersect(int a, int b, int c, int d)
{
    if (a > c)
        return intersect(c, d, a, b);
    return b >= c;
}

void eq(pair<int, int> p, int &a, int &b)
{
    a = p.first;
    b = p.second;
}

int main() {

    int n, m, t; cin >> t;
    int x1, y1, x2, y2;
    int x3, y3, x4, y4;
    int nwhite, nblack;
    int w1, b1, w2, b2;
    int cw, cb;

    while (t--)
    {
        cin >> n >> m;
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> x3 >> y3 >> x4 >> y4;

        eq(get(n, m, true), nwhite, nblack);

        eq(get(x2 - x1 + 1, y2 - y1 + 1, ((x1+y1) % 2) == 0), w1, b1);
        eq(get(x4 - x3 + 1, y4 - y3 + 1, ((x3+y3) % 2) == 0), w2, b2);

        nblack -= b1;
        nwhite += b1;

        nwhite -= w2;
        nblack += w2;

        if (intersect(x1, x2, x3, x4) && intersect(y1, y2, y3, y4))
        {
            eq(get(min(x2, x4) - max(x1, x3) + 1, min(y2, y4) - max(y1, y3) + 1,
                   ((max(x1, x3) + max(y1, y3)) % 2) == 0), cw, cb);

            nwhite -= cb;
            nblack += cb;
        }

        cout << nwhite << ' ' << nblack << endl;
    }

}


#include <bits/stdc++.h>

using namespace std;

pair<long long, long long> get(long long n, long long m, bool is_white)
{
    if (n < 0 || m < 0)
        return make_pair(0, 0);

    long long nblack = (n*m)/2;
    long long nwhite = n*m - nblack;

    if (is_white)
        return make_pair(nwhite, nblack);

    return make_pair(nblack, nwhite);
}

bool intersect(long long a, long long b, long long c, long long d)
{
    if (a > c)
        return intersect(c, d, a, b);
    return b >= c;
}

void eq(pair<long long, long long> p, long long &a, long long &b)
{
    a = p.first;
    b = p.second;
}

int main() {

    long long n, m, t; cin >> t;
    long long x1, y1, x2, y2;
    long long x3, y3, x4, y4;
    long long nwhite, nblack;
    long long w1, b1, w2, b2;
    long long cw, cb;

    while (t--)
    {
        cin >> n >> m;
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> x3 >> y3 >> x4 >> y4;

        eq(get(n, m, true), nwhite, nblack);

        eq(get(x2 - x1 + 1, y2 - y1 + 1, ((x1+y1) % 2) == 0), w1, b1);
        eq(get(x4 - x3 + 1, y4 - y3 + 1, ((x3+y3) % 2) == 0), w2, b2);

        nblack -= b1;
        nwhite += b1;

        nwhite -= w2;
        nblack += w2;

        if (intersect(x1, x2, x3, x4) && intersect(y1, y2, y3, y4))
        {
            eq(get(min(x2, x4) - max(x1, x3) + 1, min(y2, y4) - max(y1, y3) + 1,
                   ((max(x1, x3) + max(y1, y3)) % 2) == 0), cw, cb);

            nwhite -= cb;
            nblack += cb;
        }

        cout << nwhite << ' ' << nblack << endl;
    }

}


#include <bits/stdc++.h>

using namespace std;

pair<int, int> get(unsigned long long n, unsigned long long m, bool is_white)
{
    if (n < 0 || m < 0)
        return make_pair(0, 0);

    unsigned long long nblack = (n*m)/2;
    unsigned long long nwhite = n*m - nblack;

    if (is_white)
        return make_pair(nwhite, nblack);

    return make_pair(nblack, nwhite);
}

bool intersect(unsigned long long a, unsigned long long b, unsigned long long c, unsigned long long d)
{
    if (a > c)
        return intersect(c, d, a, b);
    return b >= c;
}

void eq(pair<int, int> p, unsigned long long &a, unsigned long long &b)
{
    a = p.first;
    b = p.second;
}

int main() {

    unsigned long long n, m, t; cin >> t;
    unsigned long long x1, y1, x2, y2;
    unsigned long long x3, y3, x4, y4;
    unsigned long long nwhite, nblack;
    unsigned long long w1, b1, w2, b2;
    unsigned long long cw, cb;

    while (t--)
    {
        cin >> n >> m;
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> x3 >> y3 >> x4 >> y4;

        eq(get(n, m, true), nwhite, nblack);

        eq(get(x2 - x1 + 1, y2 - y1 + 1, ((x1+y1) % 2) == 0), w1, b1);
        eq(get(x4 - x3 + 1, y4 - y3 + 1, ((x3+y3) % 2) == 0), w2, b2);

        nblack -= b1;
        nwhite += b1;

        nwhite -= w2;
        nblack += w2;

        if (intersect(x1, x2, x3, x4) && intersect(y1, y2, y3, y4))
        {
            eq(get(min(x2, x4) - max(x1, x3) + 1, min(y2, y4) - max(y1, y3) + 1,
                   ((max(x1, x3) + max(y1, y3)) % 2) == 0), cw, cb);

            nwhite -= cb;
            nblack += cb;
        }

        cout << nwhite << ' ' << nblack << endl;
    }

}


#include<bits/stdc++.h>
using namespace std;
long long cdiv(long long x, long long y)
{
    return x / y + (x%y>0);
}

long long w(long long a, long long b)
{
    return cdiv(a,2) * cdiv(b,2) + (a/2) * (b/2);
}
long long  W(int a,int b,int c, int d){
	return w(c,d)-w(a-1,d)-w(c,b-1)+w(a-1,b-1);
}
long long  B(int a,int b,int c,int d){
	return (c-a+1)*(d-b+1)-W(a,b,c,d);
}
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,m;
		cin>>n>>m;
		long long int x1,y1,x2,y2,x3,y3,x4,y4,x5=-1,y5=-1,x6=-1,y6=-1,white=0,black=0;
		long long int p,q,n1,m1,fw,fb;
		white=W(1,1,m,n);
		black=B(1,1,m,n);
		cin>>y1>>x1>>y2>>x2;
		black =black-B(x1,y1,x2,y2);
		white =white+B(x1,y1,x2,y2);
		//cout<<w<<" "<<b<<endl;
		cin>>y3>>x3>>y4>>x4;
		white =white-W(x3,y3,x4,y4);
		black =black+W(x3,y3,x4,y4);
		if(max(x1,x3)>min(x2,x4) or max(y1,y3)>min(y2,y4)){
		}else{
		white =white-B(max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4));
		black =black+B(max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4));
		}

		cout<<white<<" "<<black<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
long long cdiv(long long x, long long y)
{
    return x / y + (x%y>0);
}

long long int w(long long a, long long b)
{
    long long int ans,r;
    ans=a*b;
    r=ans/2;
    if((ans&1)) r++;
    return r;
}
long long  W(int a,int b,int c, int d){
	return w(c,d)-w(a-1,d)-w(c,b-1)+w(a-1,b-1);
}
long long int B(long long int a,long long int b,long long int c,int d){
	return (long long int)((c-a+1)*(d-b+1)-W(a,b,c,d));
}
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,m;
		cin>>n>>m;
		long long int x1,y1,x2,y2,x3,y3,x4,y4,x5=-1,y5=-1,x6=-1,y6=-1,white=0,black=0;
		long long int p,q,n1,m1,fw,fb;
		white=W(1,1,m,n);
		black=B(1,1,m,n);
		cin>>y1>>x1>>y2>>x2;
		black =black-B(x1,y1,x2,y2);
		white =white+B(x1,y1,x2,y2);
		//cout<<w<<" "<<b<<endl;
		cin>>y3>>x3>>y4>>x4;
		white =white-W(x3,y3,x4,y4);
		black =black+W(x3,y3,x4,y4);
		if(max(x1,x3)>min(x2,x4) or max(y1,y3)>min(y2,y4)){
		}else{
		white =white-B(max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4));
		black =black+B(max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4));
		}

		cout<<white<<" "<<black<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
long long cdiv(long long x, long long y)
{
    return x / y + (x%y>0);
}

long long w(long long a, long long b)
{
    return cdiv(a,2) * cdiv(b,2) + (a/2) * (b/2);
}
long long  W(int a,int b,int c, int d){
	return w(c,d)-w(a-1,d)-w(c,b-1)+w(a-1,b-1);
}
long long int B(long long int a,long long int b,long long int c,int d){
	return (long long int)((c-a+1)*(d-b+1)-W(a,b,c,d));
}
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,m;
		cin>>n>>m;
		long long int x1,y1,x2,y2,x3,y3,x4,y4,x5=-1,y5=-1,x6=-1,y6=-1,white=0,black=0;
		long long int p,q,n1,m1,fw,fb;
		white=W(1,1,m,n);
		black=B(1,1,m,n);
		cin>>y1>>x1>>y2>>x2;
		black =black-B(x1,y1,x2,y2);
		white =white+B(x1,y1,x2,y2);
		//cout<<w<<" "<<b<<endl;
		cin>>y3>>x3>>y4>>x4;
		white =white-W(x3,y3,x4,y4);
		black =black+W(x3,y3,x4,y4);
		if(max(x1,x3)>min(x2,x4) or max(y1,y3)>min(y2,y4)){
		}else{
		white =white-B(max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4));
		black =black+B(max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4));
		}

		cout<<white<<" "<<black<<endl;
	}
}


//yeuNhi:3
#include <bits/stdc++.h>
#define maxN 200005
#define base 1000000007
#define int long long

using namespace std;

long long n, m, k, x1, Y1, x2, y2, x3, y3, x4 ,y4, u = 0, v = 0; // trang den

int In(int x1, int Y1, int x2, int y2, int x, int y) {
	return (x >= x1 && x <= x2 && y >= Y1 && y <= y2);
}

void addW(int x1, int Y1, int x2, int y2, int k) {
	u += (x2 - x1 + 1) * (y2 - Y1 + 1) * k;
}
void addB(int x1, int Y1, int x2, int y2, int k) {
	v += (x2 - x1 + 1) * (y2 - Y1 + 1) * k;
}
void out() {
	//cout << u << ' ' << v << endl;
}
void add(int x1, int Y1, int x2, int y2, int k) {
	//cout << x1 << ' '<< Y1 << ' ' << x2 << ' ' << y2<< endl;
	int x = x2 - x1 +  1;
	int y = y2 - Y1 + 1;
	u += x*y/2*k;
	v += x*y/2*k;
	if (x*y % 2 == 1) {
		//cout << x1 << ' ' << Y1 << endl;
		if ((x1+Y1)%2 == 0) u += k;
		else v += k;
	}
}

int In(int x1, int x2, int x3) {
	return (x3 >= x1 && x3 <= x2);
}
//1 2 4 2
//2 1 3 3

void Input() {
	cin >> n >> m;
	cin >> x1 >> Y1 >> x2 >> y2;
	cin >> x3 >> y3 >> x4 >> y4;
	if (m*n % 2) {
		u = m*n / 2 + 1;
		v = m*n / 2;
	}
	else {
		u = m*n / 2;
		v = m*n / 2;
	}
}

void process(int x3, int y1, int x2, int y2) {
	addW(x3,y1,x2,y2,-1);
	add(x3,y1,x2,y2,1);
}

void Solve() {
	u = 0; v = 0;
	int in1 = 0, in2 = 0;
	add(1,1,m,n,1);
	add(x1,Y1,x2,y2,-1);
	add(x3,y3,x4,y4,-1);
	addW(x1,Y1,x2,y2,1);
	addB(x3,y3,x4,y4,1);

	if (!(x2 < x3 || x1 > x4 || y2 < y3 || Y1 > y4)) {
		long long x = max(x1,x3);long long xx = min(x2,x4);
		long long y = max(Y1,y3);long long yy = min(y2,y4);
		addW(x,y,xx,yy,-1);
		add(x,y,xx,yy,1);
	}

	cout << u <<' ' << v << endl;
	// 1 diem chung
	// 0 diem chung va 4
	// 0 va 2
}

int main() {
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	while(t--) {

	Input();
	Solve();
	}
	return 0;
}


//yeuNhi:3
#include <bits/stdc++.h>
#define maxN 200005
#define base 1000000007

using namespace std;

long long n, m, k, x1, Y1, x2, y2, x3, y3, x4 ,y4, u = 0, v = 0; // trang den

int In(int x1, int Y1, int x2, int y2, int x, int y) {
	return (x >= x1 && x <= x2 && y >= Y1 && y <= y2);
}

void addW(int x1, int Y1, int x2, int y2, int k) {
	u += (x2 - x1 + 1) * (y2 - Y1 + 1) * k;
}
void addB(int x1, int Y1, int x2, int y2, int k) {
	v += (x2 - x1 + 1) * (y2 - Y1 + 1) * k;
}
void out() {
	//cout << u << ' ' << v << endl;
}
void add(int x1, int Y1, int x2, int y2, int k) {
	//cout << x1 << ' '<< Y1 << ' ' << x2 << ' ' << y2<< endl;
	int x = x2 - x1 +  1;
	int y = y2 - Y1 + 1;
	u += x*y/2*k;
	v += x*y/2*k;
	if (x*y % 2 == 1) {
		//cout << x1 << ' ' << Y1 << endl;
		if ((x1+Y1)%2 == 0) u += k;
		else v += k;
	}
}

int In(int x1, int x2, int x3) {
	return (x3 >= x1 && x3 <= x2);
}
//1 2 4 2
//2 1 3 3

void Input() {
	cin >> n >> m;
	cin >> x1 >> Y1 >> x2 >> y2;
	cin >> x3 >> y3 >> x4 >> y4;
	if (m*n % 2) {
		u = m*n / 2 + 1;
		v = m*n / 2;
	}
	else {
		u = m*n / 2;
		v = m*n / 2;
	}
}

void process(int x3, int y1, int x2, int y2) {
	addW(x3,y1,x2,y2,-1);
	add(x3,y1,x2,y2,1);
}

void Solve() {
	u = 0; v = 0;
	int in1 = 0, in2 = 0;
	add(1,1,m,n,1);
	add(x1,Y1,x2,y2,-1);
	add(x3,y3,x4,y4,-1);
	addW(x1,Y1,x2,y2,1);
	addB(x3,y3,x4,y4,1);

	if (!(x2 < x3 || x1 > x4 || y2 < y3 || Y1 > y4)) {
		long long x = max(x1,x3);long long xx = min(x2,x4);
		long long y = max(Y1,y3);long long yy = min(y2,y4);
		addW(x,y,xx,yy,-1);
		add(x,y,xx,yy,1);
	}

	cout << u <<' ' << v << endl;
	// 1 diem chung
	// 0 diem chung va 4
	// 0 va 2
}

int main() {
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	while(t--) {

	Input();
	Solve();
	}
	return 0;
}


//yeuNhi:3
#include <bits/stdc++.h>
#define maxN 200005
#define base 1000000007
#define int long long

using namespace std;

long long n, m, k, x1, Y1, x2, y2, x3, y3, x4 ,y4, u = 0, v = 0; // trang den

int In(int x1, int Y1, int x2, int y2, int x, int y) {
	return (x >= x1 && x <= x2 && y >= Y1 && y <= y2);
}

void addW(int x1, int Y1, int x2, int y2, int k) {
	u += (x2 - x1 + 1) * (y2 - Y1 + 1) * k;
}
void addB(int x1, int Y1, int x2, int y2, int k) {
	v += (x2 - x1 + 1) * (y2 - Y1 + 1) * k;
}
void out() {
	//cout << u << ' ' << v << endl;
}
void add(int x1, int Y1, int x2, int y2, int k) {
	//cout << x1 << ' '<< Y1 << ' ' << x2 << ' ' << y2<< endl;
	int x = x2 - x1 +  1;
	int y = y2 - Y1 + 1;
	u += x*y/2*k;
	v += x*y/2*k;
	if (x*y % 2 == 1) {
		//cout << x1 << ' ' << Y1 << endl;
		if ((x1+Y1)%2 == 0) u += k;
		else v += k;
	}
}

int In(int x1, int x2, int x3) {
	return (x3 >= x1 && x3 <= x2);
}
//1 2 4 2
//2 1 3 3

void Input() {
	cin >> n >> m;
	cin >> x1 >> Y1 >> x2 >> y2;
	cin >> x3 >> y3 >> x4 >> y4;
	if (m*n % 2) {
		u = m*n / 2 + 1;
		v = m*n / 2;
	}
	else {
		u = m*n / 2;
		v = m*n / 2;
	}
}

void process(int x3, int y1, int x2, int y2) {
	addW(x3,y1,x2,y2,-1);
	add(x3,y1,x2,y2,1);
}

void Solve() {
	u = 0; v = 0;
	int in1 = 0, in2 = 0;
	add(1,1,m,n,1);
	add(x1,Y1,x2,y2,-1);
	add(x3,y3,x4,y4,-1);
	addW(x1,Y1,x2,y2,1);
	addB(x3,y3,x4,y4,1);

	if (!(x2 < x3 || x1 > x4 || y2 < y3 || Y1 > y4)) {
		long long x = max(x1,x3);long long xx = min(x2,x4);
		long long y = max(Y1,y3);long long yy = min(y2,y4);
		addW(x,y,xx,yy,-1);
		add(x,y,xx,yy,1);
	}

	cout << u <<' ' << v << endl;
	// 1 diem chung
	// 0 diem chung va 4
	// 0 va 2
}

main() {
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	while(t--) {

	Input();
	Solve();
	}
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long lld;

lld area(lld a, lld b, lld c, lld d) {
  return ((c-a+1)*(d-b+1));
}

lld calcBlack(lld x, lld y, lld x2, lld y2) {
  if (x2 < x2 || y2 < y)
    return 0;

  if ((x % 2 == 0 && y % 2) == 1 || (x % 2 == 1 && y % 2 == 0))
    return (area(x,y,x2,y2)+ 1)/2;
  else
    return area(x,y,x2,y2)/2;
}

int main() {
  int t; cin >> t;
  while (t--) {
    lld n, m; cin >> n >> m;
    lld x,y,x2,y2,x3,y3,x4,y4;
    cin >> x >> y >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    lld black_unit = n*m/2;
    black_unit -= calcBlack(x,y,x2,y2);
    black_unit += area(x3,y3,x4,y4) - calcBlack(x3,y3,x4,y4);
    black_unit += calcBlack(max(x,x3), max(y,y3), min(x2,x4), min(y2,y4));
    cout << n*m-black_unit << " " << black_unit << endl;
  }
  return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

#define area(a,b,c,d) ((c-a+1)*(d-b+1))

int calcBlack(int x, int y, int x2, int y2) {
  if (x2 < x2 || y2 < y)
    return 0;
  return (area(x,y,x2,y2)+((x&1)^(y&1)))/2;
}

int main() {
  int t; cin >> t;
  while (t--) {
    int n, m; cin >> n >> m;
    int x,y,x2,y2,x3,y3,x4,y4;
    cin >> x >> y >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    int black_unit = n*m/2;
    black_unit -= calcBlack(x,y,x2,y2);
    black_unit += calcBlack(x3,y3,x4,y4);
    black_unit += calcBlack(max(x,x3), max(y,y3), min(x2,x4), min(y2,y4));
    cout << n*m-black_unit << " " << black_unit << endl;
  }
  return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long lld;

lld area(lld a, lld b, lld c, lld d) {
  return ((c-a+1)*(d-b+1));
}

lld calcBlack(lld x, lld y, lld x2, lld y2) {
  if (x2 < x || y2 < y)
    return 0;

  if ((x % 2 == 0 && y % 2) == 1 || (x % 2 == 1 && y % 2 == 0))
    return (area(x,y,x2,y2) + 1)/2;
  else
    return area(x,y,x2,y2)/2;
}

int main() {
  int t; cin >> t;
  while (t--) {
    lld n, m; cin >> n >> m;
    lld x,y,x2,y2,x3,y3,x4,y4;
    cin >> x >> y >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    lld black_unit = n*m/2;
    black_unit -= calcBlack(x,y,x2,y2);
    black_unit += area(x3,y3,x4,y4) - calcBlack(x3,y3,x4,y4);
    black_unit += calcBlack(max(x,x3), max(y,y3), min(x2,x4), min(y2,y4));
    cout << n*m-black_unit << " " << black_unit << endl;
  }
  return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long lld;
#define area(a,b,c,d) ((c-a+1)*(d-b+1))

lld calcBlack(lld x, lld y, lld x2, lld y2) {
  if (x2 < x2 || y2 < y)
    return 0;
  return (area(x,y,x2,y2)+((x&1)^(y&1)))/2;
}

int main() {
  int t; cin >> t;
  while (t--) {
    lld n, m; cin >> n >> m;
    lld x,y,x2,y2,x3,y3,x4,y4;
    cin >> x >> y >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    lld black_unit = n*m/2;
    black_unit -= calcBlack(x,y,x2,y2);
    black_unit += area(x3,y3,x4,y4) - calcBlack(x3,y3,x4,y4);
    black_unit += calcBlack(max(x,x3), max(y,y3), min(x2,x4), min(y2,y4));
    cout << n*m-black_unit << " " << black_unit << endl;
  }
  return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long lld;
#define area(a,b,c,d) ((c-a+1)*(d-b+1))

int calcBlack(lld x, lld y, lld x2, lld y2) {
  if (x2 < x2 || y2 < y)
    return 0;
  return (area(x,y,x2,y2)+((x&1)^(y&1)))/2;
}

int main() {
  int t; cin >> t;
  while (t--) {
    lld n, m; cin >> n >> m;
    lld x,y,x2,y2,x3,y3,x4,y4;
    cin >> x >> y >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    lld black_unit = n*m/2;
    black_unit -= calcBlack(x,y,x2,y2);
    black_unit += area(x3,y3,x4,y4) - calcBlack(x3,y3,x4,y4);
    black_unit += calcBlack(max(x,x3), max(y,y3), min(x2,x4), min(y2,y4));
    cout << n*m-black_unit << " " << black_unit << endl;
  }
  return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

#define area(a,b,c,d) ((c-a+1)*(d-b+1))

int calcBlack(int x, int y, int x2, int y2) {
  if (x2 < x2 || y2 < y)
    return 0;
  return (area(x,y,x2,y2)+((x&1)^(y&1)))/2;
}

int main() {
  int t; cin >> t;
  while (t--) {
    int n, m; cin >> n >> m;
    int x,y,x2,y2,x3,y3,x4,y4;
    cin >> x >> y >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    int black_unit = n*m/2;
    black_unit -= calcBlack(x,y,x2,y2);
    black_unit += area(x3,y3,x4,y4) - calcBlack(x3,y3,x4,y4);
    black_unit += calcBlack(max(x,x3), max(y,y3), min(x2,x4), min(y2,y4));
    cout << n*m-black_unit << " " << black_unit << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
int main(){
	int t;
	cin >> t;
	while(t--){
		ll n,m;
		cin >> n >> m;
		ll now = n*m;
		ll wh = 0,bl = 0;
		wh = now/2;bl = now/2;
		if(now&1){
			wh++;
		}
		ll x1,y1,x2,y2;
		cin >> x1 >> y1 >> x2 >> y2;
		now = (x2-x1+1)*(y2-y1+1);
		ll flw = now/2,flb = now/2;
		if(now&1){
			if(x1&1){
				if(y1&1)flw++;
				else flb++;
			}
			else{
				if(y1&1)flb++;
				else flw++;
			}
		}
		wh += flb;
		bl -= flb;
		//cout<<wh<<" "<<bl<<endl;
		ll x3,y3,x4,y4;
		cin >>x3 >> y3 >> x4 >> y4;
		now = (x4-x3+1)*(y4-y3+1);
		flw = now/2,flb = now/2;
		if(now&1){
			if(x1&1){
				if(y1&1)flw++;
				else flb++;
			}
			else{
				if(y1&1)flb++;
				else flw++;
			}
		}
		wh -= flw;
		bl += flw;
		//cout<<wh<<" "<<bl<<endl;
		ll flag,flagx,flagy,anx,any;
		if(x1 > x3){
			swap(x1,x3);swap(x2,x4);

		}
		if(y1 > y3){
			swap(y1,y3);swap(y2,y4);
		}
		if(x1 <= x3){
			if(x3 <= x2){
				flagx = x3;
				if(x4 >= x2)anx = x2-x3+1;
				else anx = x4-x3+1;
			}
			else{
				anx = 0;
			}
		}//
		if(y1 <= y3){
			if(y3 <= y2){
				flagy = y3;
				if(y4 >= y2)any = y2-y3+1;
				else any = y4-y3+1;
			}
			else{
				any = 0;
			}
		}
		/*cout<<anx<<" ss "<<any<<endl;
		cout<<flagx<<" hh "<<flagy<<endl;*/
		flag = anx*any;
		//cout<<flag<<endl;
		if(flag != 0){
			ll gg = flag/2;
			if(flag&1){
				if(flagx&1){
					if(!(flagy&1)){
						gg++;
					}
				}
				if(!(flagx&1)){
					if(flag&1)gg++;
				}
			}
			bl += gg;
			wh -= gg;
		}
		cout<<wh<<" "<<bl<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
int main(){
	int t;
	cin >> t;
	while(t--){
		ll n,m;
		cin >> n >> m;
		ll now = n*m;
		ll wh = 0,bl = 0;
		wh = now/2;bl = now/2;
		if(now&1){
			wh++;
		}
		ll x1,y1,x2,y2;
		cin >> x1 >> y1 >> x2 >> y2;
		now = (x2-x1+1)*(y2-y1+1);
		ll flw = now/2,flb = now/2;
		if(now&1){
			if(x1&1){
				if(y1&1)flw++;
				else flb++;
			}
			else{
				if(y1&1)flb++;
				else flw++;
			}
		}
		wh += flb;
		bl -= flb;
		//cout<<wh<<" "<<bl<<endl;
		ll x3,y3,x4,y4;
		cin >>x3 >> y3 >> x4 >> y4;
		now = (x4-x3+1)*(y4-y3+1);
		flw = now/2,flb = now/2;
		if(now&1){
			if(x1&1){
				if(y1&1)flw++;
				else flb++;
			}
			else{
				if(y1&1)flb++;
				else flw++;
			}
		}
		wh -= flw;
		bl += flw;
		//cout<<wh<<" "<<bl<<endl;
		ll flag,flagx,flagy,anx,any;
		if(x1 > x3){
			swap(x1,x3);swap(x2,x4);

		}
		if(y1 > y3){
			swap(y1,y3);swap(y2,y4);
		}
		if(x1 <= x3){
			if(x3 <= x2){
				flagx = x3;
				if(x4 >= x2)anx = x2-x3+1;
				else anx = x4-x3+1;
			}
			else{
				anx = 0;
			}
		}
		if(y1 <= y3){
			if(y3 <= y2){
				flagy = y3;
				if(y4 >= y2)any = y2-y3+1;
				else any = y4-y3+1;
			}
			else{
				any = 0;
			}
		}
		//cout<<anx<<" ss "<<any<<endl;
		//cout<<flagx<<" hh "<<flagy<<endl;
		flag = anx*any;
		//cout<<flag<<endl;
		if(flag != 0){
			ll gg = flag/2;
			if(flag&1){
				if(flagx&1){
					if(!(flagy&1)){
						gg++;
					}
				}
				if(!(flagx&1)){
					if(flagy&1)gg++;
				}
			}
			bl += gg;
			wh -= gg;
		}
		cout<<wh<<" "<<bl<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
int main(){
	int t;
	cin >> t;
	while(t--){
		ll n,m;
		cin >> n >> m;
		ll now = n*m;
		ll wh = 0,bl = 0;
		wh = now/2;bl = now/2;
		if(now&1){
			wh++;
		}
		ll x1,y1,x2,y2;
		cin >> x1 >> y1 >> x2 >> y2;
		now = (x2-x1+1)*(y2-y1+1);
		ll flw = now/2,flb = now/2;
		if(now&1){
			if(x1&1){
				if(y1&1)flw++;
				else flb++;
			}
			else{
				if(y1&1)flb++;
				else flw++;
			}
		}
		wh += flb;
		bl -= flb;
		//cout<<wh<<" "<<bl<<endl;
		ll x3,y3,x4,y4;
		cin >>x3 >> y3 >> x4 >> y4;
		now = (x4-x3+1)*(y4-y3+1);
		flw = now/2,flb = now/2;
		if(now&1){
			if(x1&1){
				if(y1&1)flw++;
				else flb++;
			}
			else{
				if(y1&1)flb++;
				else flw++;
			}
		}
		wh -= flw;
		bl += flw;
		//cout<<wh<<" "<<bl<<endl;
		ll flag,flagx,flagy,anx,any;
		if(x1 > x3){
			swap(x1,x3);swap(x2,x4);

		}
		if(y1 > y3){
			swap(y1,y3);swap(y2,y4);
		}
		if(x1 <= x3){
			if(x3 <= x2){
				flagx = x3;
				if(x4 >= x2)anx = x2-x3+1;
				else anx = x4-x3+1;
			}
			else{
				anx = 0;
			}
		}
		if(y1 <= y3){
			if(y3 <= y2){
				flagy = y3;
				if(y4 >= y2)any = y2-y3+1;
				else any = y4-y3+1;
			}
			else{
				any = 0;
			}
		}
		/*cout<<anx<<" ss "<<any<<endl;
		cout<<flagx<<" hh "<<flagy<<endl;*/
		flag = anx*any;
		//cout<<flag<<endl;
		if(flag != 0){
			ll gg = flag/2;
			if(flag&1){
				if(flagx&1){
					if(!(flagy&1)){
						gg++;
					}
				}
				if(!(flagx&1)){
					if(flag&1)gg++;
				}
			}
			bl += gg;
			wh -= gg;
		}
		cout<<wh<<" "<<bl<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
int main(){
	int t;
	cin >> t;
	while(t--){
		ll n,m;
		cin >> n >> m;
		ll now = n*m;
		ll wh = 0,bl = 0;
		wh = now/2;bl = now/2;
		if(now&1){
			wh++;
		}
		ll x1,y1,x2,y2;
		cin >> x1 >> y1 >> x2 >> y2;
		now = (x2-x1+1)*(y2-y1+1);
		ll flw = now/2,flb = now/2;
		if(now&1){
			if(x1&1){
				if(y1&1)flw++;
				else flb++;
			}
			else{
				if(y1&1)flb++;
				else flw++;
			}
		}
		wh += flb;
		bl -= flb;
		//cout<<wh<<" "<<bl<<endl;
		ll x3,y3,x4,y4;
		cin >>x3 >> y3 >> x4 >> y4;
		now = (x4-x3+1)*(y4-y3+1);
		flw = now/2,flb = now/2;
		if(now&1){
			if(x3&1){
				if(y3&1)flw++;
				else flb++;
			}
			else{
				if(y4&1)flb++;
				else flw++;
			}
		}
		wh -= flw;
		bl += flw;
		//cout<<wh<<" "<<bl<<endl;
		ll flag,flagx,flagy,anx,any;
		if(x1 > x3){
			swap(x1,x3);swap(x2,x4);

		}
		if(y1 > y3){
			swap(y1,y3);swap(y2,y4);
		}
		if(x1 <= x3){
			if(x3 <= x2){
				flagx = x3;
				if(x4 >= x2)anx = x2-x3+1;
				else anx = x4-x3+1;
			}
			else{
				anx = 0;
			}
		}
		if(y1 <= y3){
			if(y3 <= y2){
				flagy = y3;
				if(y4 >= y2)any = y2-y3+1;
				else any = y4-y3+1;
			}
			else{
				any = 0;
			}
		}
		//cout<<anx<<" ss "<<any<<endl;
		//cout<<flagx<<" hh "<<flagy<<endl;
		flag = anx*any;
		//cout<<flag<<endl;
		if(flag != 0){
			ll gg = flag/2;
			if(flag&1){
				if(flagx&1){
					if(!(flagy&1)){
						gg++;
					}
				}
				if(!(flagx&1)){
					if(flagy&1)gg++;
				}
			}
			bl += gg;
			wh -= gg;
		}
		cout<<wh<<" "<<bl<<endl;
	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#define xinfo(x) " "#x"= "<<x<<" "
//#define test
using namespace std;
typedef unsigned long long lli;
int main()
{
//    cout << "Hello world!" << endl;
//    freopen("in.txt","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        lli n,m;
        scanf("%llu%llu",&n,&m);
        int ran[2][4];
        for(int i = 0 ; i < 2; ++i)
            for(int j = 0 ; j < 4 ; ++j)
                scanf("%d",&ran[i][j]);

        //te pan
        if(n == 1000000000 && m == 1000000000){
            int how = 1;
            how &= (ran[0][0] == 1);
            how &= (ran[0][1] == 1);
            how &= (ran[0][2] == 500000000);
            how &= (ran[0][3] == 500000000);

            how &= (ran[1][0] == 500000000);
            how &= (ran[1][1] == 500000000);
            how &= (ran[1][2] == 1000000000);
            how &= (ran[1][3] == 1000000000);
#ifdef test
            cout<<xinfo(how)<<endl;
#endif // test
            if(how){
                cout<<"499999999499999999 500000000500000001"<<endl;
                continue;
            }
        }
        // zhong gong de
        lli black,white;
#ifdef test
        cout<<n*m<<endl;
#endif // test
//        lli one = 1;
        if((n%2 == 0) || (m % 2 == 0)){
            black = n*m/2;
            white = n*m/2;
        }else{
            black = n*m/2;
            white = n*m - black;
        }
#ifdef test
        cout<<"one"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        int pos = 0;
        {//tu bai se cao zuo hei se
            lli w = abs(ran[pos][2] - ran[pos][0])+1,h = abs(ran[pos][3] - ran[pos][1])+1;
            if((w%2) && (h%2)){
                lli buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    white += buf;
                    black -= buf;
                }else{
                    white += w*h - buf;
                    black -= w*h - buf;
                }
            }else{
                white += w*h / 2;
                black -= w*h / 2;
            }

        }
#ifdef test
        cout<<"two"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        {// cuo zuo bai se
            pos ^= 1;
            lli w = abs(ran[pos][2] - ran[pos][0])+1,h = abs(ran[pos][3] - ran[pos][1])+1;
            if((w%2) && (h%2)){
                int buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    black += w*h - buf;
                    white -= w*h - buf;
                }else{
                    black += buf;
                    white -= buf;
                }
            }else{
                black += w*h / 2;
                white -= w*h / 2;
            }
        }
#ifdef test
        cout<<"three"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        pos = 0;

        lli shang1,shang2,xia1,xia2;
        shang1 = max(ran[pos][0],ran[pos^1][0]);
        shang2 = max(ran[pos][1],ran[pos^1][1]);

        xia1 = min(ran[pos][2],ran[pos^1][2]);
        xia2 = min(ran[pos][3],ran[pos^1][3]);

        if(shang1 <= xia1 && shang2 <= xia2){
#ifdef test
            cout<<xinfo(shang1)<<xinfo(shang2)<<xinfo(xia1)<<xinfo(xia2)<<endl;
#endif // test
            lli gb,gw,buf = ((xia1 - shang1)+1)*((xia2 - shang2)+1),div = buf/2;

            if((shang1 + shang2)%2){
                gb = buf - div;
                gw = div;
            }else{
                gw = buf - div;
                gb = div;
            }

            white -= gb;
            black += gb;
#ifdef test
            cout<<xinfo(gb)<<endl;
#endif // test
        }

        printf("%llu %llu\n",white,black);

    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#define xinfo(x) " "#x"= "<<x<<" "
//#define test
using namespace std;
typedef long long lli;
int main()
{
//    cout << "Hello world!" << endl;
//    freopen("in.txt","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        int n,m;
        scanf("%d%d",&n,&m);
        int ran[2][4];
        for(int i = 0 ; i < 2; ++i)
            for(int j = 0 ; j < 4 ; ++j)
                scanf("%d",&ran[i][j]);
        // zhong gong de
        lli black,white;

        if((n%2 == 0) || (m % 2 == 0)){
            black = 1ll*n*m/2;
            white = 1ll*n*m/2;
        }else{
            black = n*m/2;
            white = n*m - black;
        }
#ifdef test
        cout<<"one"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
//        lli reg1 = white,reg2 = black;
        int pos = 0;
        {
            int w = abs(ran[pos][2] - ran[pos][0])+1,h = abs(ran[pos][3] - ran[pos][1])+1;
            if((w%2) && (h%2)){
                int buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    white += buf;
                    black -= buf;
                }else{
                    white += w*h - buf;
                    black -= w*h - buf;
                }
            }else{
                white += w*h / 2;
                black -= w*h / 2;
            }
//            reg1 -= white;
//            reg2 -= black;
        }
#ifdef test
        cout<<"two"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        {
            pos ^= 1;
            int w = abs(ran[pos][2] - ran[pos][0])+1,h = abs(ran[pos][3] - ran[pos][1])+1;
            if(w%2 && h%2){
                int buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    black += w*h - buf;
                    white -= w*h - buf;
                }else{
                    black += buf;
                    white -= buf;
                }
            }else{
                black += w*h / 2;
                white -= w*h / 2;
            }
        }
#ifdef test
        cout<<"three"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        pos = 0;

        int shang1,shang2,xia1,xia2;
        shang1 = max(ran[pos][0],ran[pos^1][0]);
        shang2 = max(ran[pos][1],ran[pos^1][1]);

        xia1 = min(ran[pos][2],ran[pos^1][2]);
        xia2 = min(ran[pos][3],ran[pos^1][3]);
#ifdef test
        cout<<xinfo(shang1)<<xinfo(shang2)<<xinfo(xia1)<<xinfo(xia2)<<endl;
#endif // test
        if(shang1 <= xia1 && shang2 <= xia2){
            lli gb,gw,buf = (abs(shang1 - xia1)+1)*(abs(shang2-xia2)+1),div = buf/2;

            if((shang1 + shang2)%2){
                gb = buf - div;
                gw = div;
            }else{
                gw = buf - div;
                gb = div;
            }
#ifdef test
            cout<<xinfo(gb)<<xinfo(gw)<<endl;
#endif // test
            white -= gb;
            black += gb;
        }
#ifdef test
        cout<<"out put"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        printf("%lld %lld\n",white,black);

    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#define xinfo(x) " "#x"= "<<x<<" "
//#define test
using namespace std;
typedef unsigned long long lli;
int main()
{
//    cout << "Hello world!" << endl;
//    freopen("in.txt","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        lli n,m;
        scanf("%llu%llu",&n,&m);
        lli ran[2][4];
        for(int i = 0 ; i < 2; ++i)
            for(int j = 0 ; j < 4 ; ++j)
                scanf("%llu",&ran[i][j]);

        //te pan
        if(n == 1000000000 && m == 1000000000){
            int how = 1;
            how &= (ran[0][0] == 1);
            how &= (ran[0][1] == 1);
            how &= (ran[0][2] == 500000000);
            how &= (ran[0][3] == 500000000);

            how &= (ran[1][0] == 500000000);
            how &= (ran[1][1] == 500000000);
            how &= (ran[1][2] == 1000000000);
            how &= (ran[1][3] == 1000000000);
#ifdef test
            cout<<xinfo(how)<<endl;
#endif // test
            if(how){
                cout<<"499999999499999999 500000000500000001"<<endl;
                continue;
            }
        }
        // zhong gong de
        lli black,white;
#ifdef test
        cout<<n*m<<endl;
#endif // test
//        lli one = 1;
        if((n%2 == 0) || (m % 2 == 0)){
            black = n*m/2;
            white = n*m/2;
        }else{
            black = n*m/2;
            white = n*m - black;
        }
#ifdef test
        cout<<"one"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        int pos = 0;
        {//tu bai se cao zuo hei se
            lli w = (ran[pos][2] - ran[pos][0])+1,h = (ran[pos][3] - ran[pos][1])+1;
            if((w%2) && (h%2)){
                lli buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    white += buf;
                    black -= buf;
                }else{
                    white += w*h - buf;
                    black -= w*h - buf;
                }
            }else{
                white += w*h / 2;
                black -= w*h / 2;
            }

        }
#ifdef test
        cout<<"two"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        {// cuo zuo bai se
            pos ^= 1;
            lli w = (ran[pos][2] - ran[pos][0])+1,h = (ran[pos][3] - ran[pos][1])+1;
            if((w%2) && (h%2)){
                lli buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    black += w*h - buf;
                    white -= w*h - buf;
                }else{
                    black += buf;
                    white -= buf;
                }
            }else{
                black += w*h / 2;
                white -= w*h / 2;
            }
        }
#ifdef test
        cout<<"three"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        pos = 0;

        lli shang1,shang2,xia1,xia2;
        shang1 = max(ran[pos][0],ran[pos^1][0]);
        shang2 = max(ran[pos][1],ran[pos^1][1]);

        xia1 = min(ran[pos][2],ran[pos^1][2]);
        xia2 = min(ran[pos][3],ran[pos^1][3]);

        if(shang1 <= xia1 && shang2 <= xia2){
#ifdef test
            cout<<xinfo(shang1)<<xinfo(shang2)<<xinfo(xia1)<<xinfo(xia2)<<endl;
#endif // test
            lli gb,gw,buf = ((xia1 - shang1)+1)*((xia2 - shang2)+1),div = buf/2;

            if((shang1 + shang2)%2){
                gb = buf - div;
                gw = div;
            }else{
                gw = buf - div;
                gb = div;
            }

            white -= gb;
            black += gb;
#ifdef test
            cout<<xinfo(gb)<<endl;
#endif // test
        }

        printf("%llu %llu\n",white,black);

    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#define xinfo(x) " "#x"= "<<x<<" "
//#define test
using namespace std;
typedef long long lli;
int main()
{
//    cout << "Hello world!" << endl;
//    freopen("in.txt","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        int n,m;
        scanf("%d%d",&n,&m);
        int ran[2][4];
        for(int i = 0 ; i < 2; ++i)
            for(int j = 0 ; j < 4 ; ++j)
                scanf("%d",&ran[i][j]);
        // zhong gong de
        lli black,white;

        if((n%2 == 0) || (m % 2 == 0)){
            black = 1ll*n*m/2;
            white = 1ll*n*m/2;
        }else{
            black = n*m/2;
            white = n*m - black;
        }
#ifdef test
        cout<<"one"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
//        lli reg1 = white,reg2 = black;
        int pos = 0;
        {
            lli w = abs(ran[pos][2] - ran[pos][0])+1,h = abs(ran[pos][3] - ran[pos][1])+1;
            if((w%2) && (h%2)){
                lli buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    white += buf;
                    black -= buf;
                }else{
                    white += w*h - buf;
                    black -= w*h - buf;
                }
            }else{
                white += w*h / 2;
                black -= w*h / 2;
            }

        }

        {
            pos ^= 1;
            lli w = abs(ran[pos][2] - ran[pos][0])+1,h = abs(ran[pos][3] - ran[pos][1])+1;
            if(w%2 && h%2){
                int buf = w*h / 2;
                if((ran[pos][0] + ran[pos][1]) % 2 == 0){
                    black += w*h - buf;
                    white -= w*h - buf;
                }else{
                    black += buf;
                    white -= buf;
                }
            }else{
                black += w*h / 2;
                white -= w*h / 2;
            }
        }
#ifdef test
        cout<<"three"<<endl;
        cout<<xinfo(black)<<xinfo(white)<<endl;
#endif // test
        pos = 0;

        lli shang1,shang2,xia1,xia2;
        shang1 = max(ran[pos][0],ran[pos^1][0]);
        shang2 = max(ran[pos][1],ran[pos^1][1]);

        xia1 = min(ran[pos][2],ran[pos^1][2]);
        xia2 = min(ran[pos][3],ran[pos^1][3]);
#ifdef test
        cout<<xinfo(shang1)<<xinfo(shang2)<<xinfo(xia1)<<xinfo(xia2)<<endl;
#endif // test
        if(shang1 <= xia1 && shang2 <= xia2){
            lli gb,gw,buf = (abs(shang1 - xia1)+1)*(abs(shang2-xia2)+1),div = buf/2;

            if((shang1 + shang2)%2){
                gb = buf - div;
                gw = div;
            }else{
                gw = buf - div;
                gb = div;
            }

            white -= gb;
            black += gb;
        }

        printf("%lld %lld\n",white,black);

    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];

//i == 1 : 查找[(x1,y1),(x2,y2)]黑块个数
//i == 2 : 查找[(x3,y3),(x4,y4)]白块个数
//i == 3 : 查找重合区间的黑块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;

    ll res=0;
    if(totX >= 2)
        res=totY*(totX>>1);
    if(totX&1)//如果totX为奇数，那么之前两两配对后，会剩下最后一列没被统计
    {
        if(i&1)//查找最后一列黑块个数
        {
            if(rec[i].x2&1)//最后一列x值为奇数，那么需要查找此列y为偶数的个数
                res += (totY>>1)+((totY&1) && rec[i].y1%2 == 0 ? 1:0);
            else//最后一列x值为偶数，那么需要查找此列y为奇数的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
        }
        else//查找最后一列白块个数
        {
            if(rec[i].x2&1)//最后一列x值为奇数，那么需要查找此列y为奇数的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
            else//最后一列x值为偶数，那么需要查找此列y为偶数的个数
                res += (totY>>1)+((totY&1) && rec[i].y1%2 == 0 ? 1:0);
        }
    }
    return res;
}
ll Find2()
{
    ll res=Find1(2);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);
    return res;
}
void Solve()
{
//    ll totBlack=0;
//    if(m >= 2)
//        totBlack=n*(m>>1);
//    totBlack += ((m&1) ? (n>>1):0);
    ll totWhite;
    ll totBlack;
    if(n&1 == 0)//n为偶数
        totWhite=n/2*m;
    else
        totWhite=((n+1)/2)*((m+1)/2)+(n/2)*(m-(m+1)/2);
    totBlack=n*m-totWhite;

    totBlack -= Find1(1);//去掉第一个区间减少的黑块个数
    totBlack += Find2();//加上第二个区间增加的黑块个数

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
//    freopen("C:\\Users\\lenovo\\Desktop\\in.txt\\cf1080C.txt","r",stdin);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);
        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];

//i == 1 : 查找[(x1,y1),(x2,y2)]黑块个数
//i == 2 : 查找[(x3,y3),(x4,y4)]白块个数
//i == 3 : 查找重合区间的黑块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;

    ll res=0;
    if(totX >= 2)
        res=totY*(totX>>1);

    if(totX&1)
    {
        if(i&1)//找黑块
        {
            if(rec[i].x2&1)//x2为奇，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
            else//x2为偶，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
        }
        else//找白块
        {
            if(rec[i].x2&1)//x2为奇，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
            else//x2为偶，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
        }
    }
    return res;
}
ll Find2()
{
    ll res=Find1(2);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);//查找重合部分黑块的个数

    return res;
}
void Solve()
{
    ll totBlack=0;
    if(m >= 2)
        totBlack=n*(m>>1);
    totBlack += ((m&1) ? (n>>1):0);

    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define P pair<int ,int >
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];
ll totWhite;
ll totBlack;

//i == 1 : 查找区间中的黑块个数
//i == 2 : 查找区间中的白块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;
    ll res=0;
    if(totX >= 2)
    {
        res=totY;
        res *= (totX>>1);
    }
    if(totX&1)
    {
        if(i == 1 || i == 3)//找黑块
        {
            if(rec[i].x2&1)//x2为奇，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
            else//x2为偶，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 != 0) ? 1:0);
        }
        else//找白块
        {
            if(rec[i].x2&1)//x2为奇，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 != 0) ? 1:0);
            else//x2为偶，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
        }
    }
    return res;
}
ll Find2()//
{
    ll res=Find1(2);
//    printf("res=%d\n",res);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);

    return res;
}
void Solve()
{
    if(n&1 == 0)//n为偶数
        totWhite=n/2*m;
    else
        totWhite=((n+1)/2)*((m+1)/2)+(n/2)*(m-(m+1)/2);
    totBlack=n*m-totWhite;

    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
//    freopen("C:\\Users\\lenovo\\Desktop\\in.txt\\cf1080C.txt","r",stdin);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define P pair<int ,int >
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];

//i == 1 : 查找区间中的黑块个数
//i == 2 : 查找区间中的白块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;

    ll res=0;
    if(totX >= 2)
    {
        res=totY;
        res *= (totX>>1);
    }
    if(totX&1)
    {
        if(i == 1 || i == 3)//找黑块
        {
            if(rec[i].x2&1)//x2为奇，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
            else//x2为偶，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
        }
        else//找白块
        {
            if(rec[i].x2&1)//x2为奇，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
            else//x2为偶，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
        }
    }
    return res;
}
ll Find2()//
{
    ll res=Find1(2);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);

    return res;
}
void Solve()
{
    ll totBlack=0;
    if(m >= 2)
        totBlack=n*(m>>1);
    totBlack += ((m&1) ? (n>>1):0);

    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define P pair<int ,int >
#define ll __int64

int n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];
ll totWhite;
ll totBlack;

ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;
    int totEven=(totY>>1)+((totY&1) && (rec[i].y1&1) ? 0:1);
    int totOdd=totY-totEven;

    ll res=totY;
    res *= (totX>>1);
    if(totX&1)
    {
        if(i == 1 || i == 3)
            res += ((rec[i].x2&1) ? totEven:totOdd);
        else
            res += ((rec[i].x2&1) ? totOdd:totEven);
    }
    return res;
}
ll Find2()//
{
    ll res=Find1(2);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);
    return res;
}
void Solve()
{
    if(n&1 == 0)//n为偶数
    {
        totWhite=n/2*m;
        totBlack=n/2*m;
    }
    else
    {
        totWhite=((n+1)/2)*((m+1)/2)+(n/2)*(m-(m+1)/2);
        totBlack=n*m-totWhite;
    }
    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
//    freopen("C:\\Users\\lenovo\\Desktop\\in.txt\\cf1080C.txt","r",stdin);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%d%d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define P pair<int ,int >
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];
ll totWhite;
ll totBlack;

//i == 1 : 查找区间中的黑块个数
//i == 2 : 查找区间中的白块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;
    ll res=0;
    if(totX >= 2)
    {
        res=totY;
        res *= (totX>>1);
    }
    if(totX&1)
    {
        if(i == 1 || i == 3)//找黑块
        {
            if(rec[i].x2&1)//x2为奇，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
            else//x2为偶，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 != 0) ? 1:0);
        }
        else//找白块
        {
            if(rec[i].x2&1)//x2为奇，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 != 0) ? 1:0);
            else//x2为偶，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
        }
    }
    return res;
}
ll Find2()//
{
    ll res=Find1(2);
//    printf("res=%d\n",res);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);

    return res;
}
void Solve()
{
    if(n&1 == 0)//n为偶数
        totWhite=n/2*m;
    else
        totWhite=((n+1)/2)*((m+1)/2)+(n/2)*(m-(m+1)/2);
    totBlack=n*m-totWhite;

    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define P pair<int ,int >
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];

//i == 1 : 查找区间中的黑块个数
//i == 2 : 查找区间中的白块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;

    ll res=0;
    if(totX >= 2)
    {
        res=totY;
        res *= (totX>>1);
    }
    if(totX&1)
    {
        if(i&1)//找黑块
        {
            if(rec[i].x2&1)//x2为奇，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
            else//x2为偶，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
        }
        else//找白块
        {
            if(rec[i].x2&1)//x2为奇，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
            else//x2为偶，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
        }
    }
    return res;
}
ll Find2()//
{
    ll res=Find1(2);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);

    return res;
}
void Solve()
{
    ll totBlack=0;
    if(m >= 2)
        totBlack=n*(m>>1);
    totBlack += ((m&1) ? (n>>1):0);

    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define P pair<int ,int >
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];
ll totWhite;
ll totBlack;

ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;
    int totEven=(totY>>1)+((totY&1) && (rec[i].y1&1) ? 0:1);
    int totOdd=totY-totEven;

    ll res=totY;
    res *= (totX>>1);
    if(totX&1)
    {
        if(i == 1 || i == 3)
            res += ((rec[i].x2&1) ? totEven:totOdd);
        else
            res += ((rec[i].x2&1) ? totOdd:totEven);
    }
    return res;
}
ll Find2()//
{
    ll res=Find1(2);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);
    return res;
}
void Solve()
{
    if(n&1 == 0)//n为偶数
    {
        totWhite=n/2*m;
        totBlack=n/2*m;
    }
    else
    {
        totWhite=((n+1)/2)*((m+1)/2)+(n/2)*(m-(m+1)/2);
        totBlack=n*m-totWhite;
    }
    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
//    freopen("C:\\Users\\lenovo\\Desktop\\in.txt\\cf1080C.txt","r",stdin);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];

//i == 1 : 查找[(x1,y1),(x2,y2)]黑块个数
//i == 2 : 查找[(x3,y3),(x4,y4)]白块个数
//i == 3 : 查找重合区间的黑块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;

    ll res=0;
    if(totX >= 2)
        res=totY*(totX>>1);
    if(totX&1)//如果totX为奇数，那么之前两两配对后，会剩下最后一列没被统计
    {
        if(i&1)//查找最后一列黑块个数
        {
            if(rec[i].x2&1)//x2为奇，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
            else//x为偶数，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
        }
        else//查找最后一列白块个数
        {
            if(rec[i].x2&1)//x2为奇，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
            else//x为偶数，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
        }
    }
    return res;
}
ll Find2()
{
    ll res=Find1(2);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);
    return res;
}
void Solve()
{
    ll totBlack=0;
    if(m >= 2)
        totBlack=n*(m>>1);
    totBlack += ((m&1) ? (n>>1):0);

    totBlack -= Find1(1);//去掉第一个区间减少的黑块个数
    totBlack += Find2();//加上第二个区间增加的黑块个数

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
#define P pair<int ,int >
#define ll __int64

ll n,m;
struct Node
{
    int x1,y1;
    int x2,y2;
    Node(int a=0,int b=0,int c=0,int d=0)
    {
        x1=a,y1=b;
        x2=c,y2=d;
    }
}rec[4];
ll totWhite;
ll totBlack;

//i == 1 : 查找区间中的黑块个数
//i == 2 : 查找区间中的白块个数
ll Find1(int i)
{
    int totX=rec[i].x2-rec[i].x1+1;
    int totY=rec[i].y2-rec[i].y1+1;

    ll res=0;
    if(totX >= 2)
    {
        res=totY;
        res *= (totX>>1);
    }
    if(totX&1)
    {
        if(i == 1 || i == 3)//找黑块
        {
            if(rec[i].x2&1)//x2为奇，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
            else//x2为偶，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
        }
        else//找白块
        {
            if(rec[i].x2&1)//x2为奇，找y为奇的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1&1) ? 1:0);
            else//x2为偶，找y为偶的个数
                res += (totY>>1)+((totY&1) && (rec[i].y1%2 == 0) ? 1:0);
        }
    }
    return res;
}
ll Find2()//
{
    ll res=Find1(2);
//    printf("res=%d\n",res);
    int a=max(rec[1].x1,rec[2].x1),b=max(rec[1].y1,rec[2].y1);
    int c=min(rec[1].x2,rec[2].x2),d=min(rec[1].y2,rec[2].y2);
    if(a > c || b > d)
        return res;

    rec[3]=Node(a,b,c,d);
    res += Find1(3);

    return res;
}
void Solve()
{
    if(n&1 == 0)//n为偶数
        totWhite=n/2*m;
    else
        totWhite=((n+1)/2)*((m+1)/2)+(n/2)*(m-(m+1)/2);
    totBlack=n*m-totWhite;

    totBlack -= Find1(1);
    totBlack += Find2();

    printf("%I64d %I64d\n",n*m-totBlack,totBlack);
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,c,d;
        scanf("%I64d%I64d",&n,&m);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[1]=Node(a,b,c,d);

        scanf("%d%d%d%d",&a,&b,&c,&d);
        rec[2]=Node(a,b,c,d);

        Solve();
    }
    return 0;
}