Recently, Masha was presented with a chessboard with a height of $n$ and a width of $m$.

The rows on the chessboard are numbered from $1$ to $n$ from bottom to top. The columns are numbered from $1$ to $m$ from left to right. Therefore, each cell can be specified with the coordinates $(x,y)$, where $x$ is the column number, and $y$ is the row number (do not mix up).

Let us call a rectangle with coordinates $(a,b,c,d)$ a rectangle lower left point of which has coordinates $(a,b)$, and the upper right one — $(c,d)$.

The chessboard is painted black and white as follows:

 [Image] 

 An example of a chessboard. 

Masha was very happy with the gift and, therefore, invited her friends Maxim and Denis to show off. The guys decided to make her a treat — they bought her a can of white and a can of black paint, so that if the old board deteriorates, it can be repainted. When they came to Masha, something unpleasant happened: first, Maxim went over the threshold and spilled white paint on the rectangle $(x_1,y_1,x_2,y_2)$. Then after him Denis spilled black paint on the rectangle $(x_3,y_3,x_4,y_4)$.

To spill paint of color $color$ onto a certain rectangle means that all the cells that belong to the given rectangle become $color$. The cell dyeing is superimposed on each other (if at first some cell is spilled with white paint and then with black one, then its color will be black).

Masha was shocked! She drove away from the guests and decided to find out how spoiled the gift was. For this, she needs to know the number of cells of white and black color. Help her find these numbers!


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10^3$) — the number of test cases.

Each of them is described in the following format:

The first line contains two integers $n$ and $m$ ($1 \le n,m \le 10^9$) — the size of the board.

The second line contains four integers $x_1$, $y_1$, $x_2$, $y_2$ ($1 \le x_1 \le x_2 \le m, 1 \le y_1 \le y_2 \le n$) — the coordinates of the rectangle, the white paint was spilled on.

The third line contains four integers $x_3$, $y_3$, $x_4$, $y_4$ ($1 \le x_3 \le x_4 \le m, 1 \le y_3 \le y_4 \le n$) — the coordinates of the rectangle, the black paint was spilled on.


-----Output-----

Output $t$ lines, each of which contains two numbers — the number of white and black cells after spilling paint, respectively.


-----Example-----
Input
5
2 2
1 1 2 2
1 1 2 2
3 4
2 2 3 2
3 1 4 3
1 5
1 1 5 1
3 1 5 1
4 4
1 1 4 2
1 3 4 4
3 4
1 2 4 2
2 1 3 3

Output
0 4
3 9
2 3
8 8
4 8



-----Note-----

Explanation for examples:

The first picture of each illustration shows how the field looked before the dyes were spilled. The second picture of each illustration shows how the field looked after Maxim spoiled white dye (the rectangle on which the dye was spilled is highlighted with red). The third picture in each illustration shows how the field looked after Denis spoiled black dye (the rectangle on which the dye was spilled is highlighted with red).

In the first test, the paint on the field changed as follows:

 [Image] 

In the second test, the paint on the field changed as follows:

 [Image] 

In the third test, the paint on the field changed as follows:

 [Image] 

In the fourth test, the paint on the field changed as follows:

 [Image] 

In the fifth test, the paint on the field changed as follows:

 [Image]

Difficulty: interview

Starter code:

Solutions:
def ii():
    return int(input())
def mi():
    return map(int, input().split())
def li():
    return list(mi())

def pre(x, y):
    w = x * (y // 2) + (y % 2) * (x + 1) // 2
    b = x * (y // 2) + (y % 2) * x // 2
    assert w + b == x * y
    return w

def count(x1, y1, x2, y2):
    w = pre(x2, y2) + pre(x1 - 1, y1 - 1) - pre(x2, y1 - 1) - pre(x1 - 1, y2)
    b = (x2 - x1 + 1) * (y2 - y1 + 1) - w
    return w, b

for t in range(ii()):
    n, m = mi()
    x1, y1, x2, y2 = mi()
    x3, y3, x4, y4 = mi()
    w = pre(m, n)
    b = m * n - w
    # white spill
    wc, bc = count(x1, y1, x2, y2)
    w -= wc
    b -= bc
    w += (x2 - x1 + 1) * (y2 - y1 + 1)
    # black spill
    if max(x1, x3) <= min(x2, x4) and max(y1, y3) <= min(y2, y4):
        x5 = max(x1, x3)
        y5 = max(y1, y3)
        x6 = min(x2, x4)
        y6 = min(y2, y4)
        w -= (x6 - x5 + 1) * (y6 - y5 + 1)
        wc, bc = count(x5, y5, x6, y6)
        w += wc
        b += bc
    wc, bc = count(x3, y3, x4, y4)
    w -= wc
    b -= bc
    b += (x4 - x3 + 1) * (y4 - y3 + 1)
    print(w, b)

def main():
    def calc(x1, y1, x2, y2):
        if x1 > x2 or y1 > y2:
            return 0
        if (x2 - x1 + 1) * (y2 - y1 + 1) % 2 == 0:
            return (x2 - x1 + 1) * (y2 - y1 + 1) // 2
        if (x1 + y1) % 2 == 1:
            return (x2 - x1 + 1) * (y2 - y1 + 1) // 2 + 1
        return (x2 - x1 + 1) * (y2 - y1 + 1) // 2
    T = int(input())
    for t in range(T):
        n, m = list(map(int, input().split()))
        a, b, c, d = list(map(int, input().split()))
        e, f, g, h = list(map(int, input().split()))
        j, k, l, q = max(a, e), max(b, f), min(c, g), min(d, h)
        black = calc(1, 1, n, m) - calc(a, b, c, d) - calc(e, f, g, h) + (h - f + 1) * (g - e + 1) + calc(j,k,l,q)
        print(n * m - black, black)

main()


import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    q = I()
    rr = []

    def f(a,b,c,d):
        if a > c or b > d:
            return (0,0)
        sa = c-a + 1
        sb = d-b + 1
        g = h = (sa * sb) // 2
        if (sa*sb) % 2 == 1:
            g += 1

        if (a+b) % 2 == 0:
            return (g,h)
        return (h,g)

    def fa(a):
        return f(a[0],a[1],a[2],a[3])

    for _ in range(q):
        n,m = LI()
        wa = LI()
        ba = LI()
        wc,bc = f(1,1,n,m)
        w1,b1 = fa(wa)
        w2,b2 = fa(ba)
        w3,b3 = f(max(wa[0],ba[0]),max(wa[1],ba[1]),min(wa[2],ba[2]),min(wa[3],ba[3]))

        wc += b1
        bc -= b1
        wc -= w2
        bc += w2
        wc -= b3
        bc += b3
        rr.append('{} {}'.format(wc,bc))


    return "\n".join(map(str,rr))


print(main())


def color(x, y):
	# print(f'color(x = {x}, y = {y}) called')
	return 'white' if (x + y) % 2 == 0 else 'black'


def white(x1, y1, x2, y2):
	""" x1 <= x2, y1 <= y2 """
	# print(f'white(x1 = {x1}, y1 = {y1}, x2 = {x2}, y2 = {y2}) called')
	if x1 > x2 or y1 > y2:
		return 0

	if color(x1, y1) != color(x2, y2):
		return (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	else:
		if color(x1, y1) == color(x1, y2) == color(x2, y1) == 'white':
			return ((x2 - x1 + 1) * (y2 - y1 + 1) + 1) // 2
		elif color(x1, y1) == color(x1, y2) == color(x2, y1) == 'black':
			return ((x2 - x1 + 1) * (y2 - y1 + 1) - 1) // 2
		else:
			return (x2 - x1 + 1) * (y2 - y1 + 1) // 2	


def black(x1, y1, x2, y2):
	""" x1 <= x2, y1 <= y2 """
	if x1 > x2 or y1 > y2:
		return 0

	return (x2 - x1 + 1) * (y2 - y1 + 1) - white(x1, y1, x2, y2)


def intersect_1D(x1, x2, x3, x4):
	""" x1 <= x2, x3 <= x4 """
	return max(x1, x3), min(x2, x4)


def intersect_2D(x1, y1, x2, y2, x3, y3, x4, y4):
	""" x1 <= x2, x3 <= x4, y1 <= y2, y3 <= y4 """
	xl, xr = intersect_1D(x1, x2, x3, x4)
	yl, yr = intersect_1D(y1, y2, y3, y4)
	return xl, yl, xr, yr


for i in range(int(input())):
	n, m = list(map(int, input().split()))
	# print(f'n = {n}, m = {m}')
	x1, y1, x2, y2 = list(map(int, input().split()))
	# print(f'x1 = {x1}, y1 = {y1}, x2 = {x2}, y2 = {y2}')
	x3, y3, x4, y4 = list(map(int, input().split()))
	# print(f'x3 = {x3}, y3 = {y3}, x4 = {x4}, y4 = {y4}')

	w0, b0 = white(1, 1, m, n), black(1, 1, m, n)
	# print(f'w0 = {w0}, b0 = {b0}')

	_b0 = black(x1, y1, x2, y2)
	# print(f'_b0 = {_b0}')
	w1, b1 = w0 + _b0, b0 - _b0

	_w1 = white(x3, y3, x4, y4)
	# print(f'_w1 = {_w1}')
	w2, b2 = w1 - _w1, b1 + _w1

	xl, yl, xr, yr = intersect_2D(x1, y1, x2, y2, x3, y3, x4, y4)
	# print(f'xl = {xl}, yl = {yl}, xr = {xr}, yr = {yr}')
	_b2 = black(xl, yl, xr, yr)
	# print(f'_b2 = {_b2}')
	w3, b3 = w2 - _b2, b2 + _b2

	print(w3, b3)


t = int(input())

def getcol(x1, y1, x2, y2):
    dx = max((x2-x1+1), 0)
    dy = max((y2-y1+1), 0)
    b = w = dx*dy//2
    if dx % 2 and dy % 2:
        if (x1+y1) % 2:
            b = b + 1
        else:
            w = w + 1
    return w, b

for _ in range(t):
    n, m = list(map(int, input().split()))
    x1, y1, x2, y2 = list(map(int, input().split()))
    x3, y3, x4, y4 = list(map(int, input().split()))
    w, b = getcol(1,1,n,m)
    w1, b1 = getcol(x1,y1,x2,y2)
    w2, b2 = getcol(x3,y3,x4,y4)
    w3, b3 = getcol(max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4))
    woff = w-w1-w2+w3
    boff = b-b1-b2+b3
    print(woff+w1-w3+b1-b3, boff+w3+b3+b2-b3+w2-w3)


def area(rect):
    if rect is None:
        return 0
    x1, y1, x2, y2 = rect
    return (x2-x1+1) * (y2-y1+1)


def get_w(rect):
    if rect is None:
        return 0#, 0

    x1, y1, x2, y2 = rect

    ra = area(rect)
    more, less = (ra + 1) // 2, ra // 2

    if (x1 + y1) % 2 == 0:
        return more #, less
    else:
        return less #, more


def intersect_rects(r1, r2):
    out = []
    for i, a, b in zip(list(range(4)), r1, r2):
        out.append(max(a,b) if i < 2 else min(a,b))

    if out[0] > out[2] or out[1] > out[3]:
        return None
    return out


def main():
    n, m = list(map(int, input().split()))
    rect1 = list(map(int, input().split()))
    rect2 = list(map(int, input().split()))
    rect12 = intersect_rects(rect1, rect2)

    w_start = get_w([1,1,n,m])
    w1 = get_w(rect1)
    w2 = get_w(rect2)
    w12 = get_w(rect12)

    w = w_start - w1 - w2 + w12 + area(rect1) - area(rect12)
    print(w, n*m-w)


q = int(input())
for i in range(q):
    main()


#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
T, = getIntList()
#print(N)
def isin( x,y, M):
    if M[0] <= x <= M[2] and M[1] <= y <= M[3]:
        return True
    return False

for _ in range(T):
    N, M = getIntList()
    m1 = getIntList()
    m2 = getIntList()
    zx = [0, M]
    zx += [m1[0]-1, m1[2]]
    zx += [m2[0]-1, m2[2]]
    zx.sort()
    zy = [0, N]
    zy += [m1[1]-1, m1[3]]
    zy += [m2[1]-1, m2[3]]
    zy.sort()
    totB = 0
    for i0 in range(5):
        if zx[i0] == zx[i0+1]: continue
        for i1 in range(5):
            if zy[i1] == zy[i1+1]: continue
            
            x0 = zx[i0]+1
            y0 = zy[i1]+1
            dprint('x0,y0', x0,y0)
            size = (zx[i0+1] - zx[i0] ) *( zy[i1+1] - zy[i1]) 
            if isin(x0,y0, m2):
                dprint('black')
                totB += size
            elif isin(x0,y0, m1):
                dprint('white')
                pass
            else:
                totB+= size//2
                if size%2==1:
                    if (x0+y0)%2==1:
                        dprint('extra black')
                        totB+=1
    print(N*M - totB, totB)
                    



def num_sq(x,y,x2,y2):
    # b, w
    a = (abs(x2-x)+1)
    b = (abs(y2-y)+1)
    if a % 2 == 0 or b % 2 == 0:
        return (a*b // 2, a*b // 2)
    if (x+y) % 2 == 0:
        num_b = a * b // 2
        return (num_b, a * b - num_b)
    num_w = a * b // 2
    return (a * b - num_w, num_w)
def pt_in(p1, r1, r2):
    return r1[0] <= p1[0] <= r2[0] and r1[1] <= p1[1] <= r2[1]
def intc(p1, p2, p3, p4):
    x1 = max(p1[0], p3[0])
    x2 = min(p2[0], p4[0])
    y1 = max(p1[1], p3[1])
    y2 = min(p2[1], p4[1])
    if x1 <= x2 and y1 <= y2:
        return ((x1, y1), (x2, y2))
    return None

num_ = int(input())
for _ in range(num_):
    n, m = list(map(int, input().split()))
    x1,y1,x2,y2 = list(map(int,input().split()))
    x3,y3,x4,y4 = list(map(int,input().split()))
    p1 = (x1,y1)
    p2 = (x2,y2)
    p3 = (x3,y3)
    p4 = (x4,y4)
    all_b, all_w = num_sq(1, 1, n, m)
    tmp = intc(p1, p2, p3, p4)
    if tmp:
        intc_1, intc_2 = tmp
        t_b, t_w = num_sq(intc_1[0], intc_1[1], intc_2[0], intc_2[1])
    b,w = num_sq(x1,y1,x2,y2)
    if tmp:
        b -= t_b
        w -= t_w
    b2,w2 = num_sq(x3,y3,x4,y4)
    if tmp:
        b2 -= t_b
        w2 -= t_w
    w_tot, b_tot = (all_w + b - w2, all_b - b + w2)
    if tmp:
        w_tot -= t_w
        b_tot += t_w
    print(w_tot, b_tot)



def get_colors(x1, y1, x2, y2):
    w = x2 - x1 + 1
    h = y2 - y1 + 1
    if w % 2 == 0 or h % 2 == 0:
        black = w * h // 2
        white = w * h // 2
    else:
        oddx = w // 2
        if x1 % 2 == 1 and x2 % 2 == 1:
            oddx += 1
        oddy = h // 2
        if y1 % 2 == 1 and y2 % 2 == 1:
            oddy += 1
        evenx = w // 2
        if x1 % 2 == 0 and x2 % 2 == 0:
            evenx += 1
        eveny = h // 2
        if y1 % 2 == 0 and y2 % 2 == 0:
            eveny += 1
        white = oddx * oddy + evenx * eveny
        black = w * h - white
    return white, black

def get_intersection(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2):
    if ax1 > bx2:
        return None, None, None, None
    if bx1 > ax2:
        return None, None, None, None
    if ay1 > by2:
        return None, None, None, None
    if by1 > ay2:
        return None, None, None, None
    return max(ax1, bx1), max(ay1, by1), min(ax2, bx2), min(ay2, by2)

t = int(input())
for i in range(t):
    n, m = map(int, input().split())
    white, black = get_colors(1, 1, m, n)
    wx1, wy1, wx2, wy2 = map(int, input().split())
    w, b = get_colors(wx1, wy1, wx2, wy2)
    white += b
    black -= b
    bx1, by1, bx2, by2 = map(int, input().split())
    ix1, iy1, ix2, iy2 = get_intersection(wx1, wy1, wx2, wy2, bx1, by1, bx2, by2)
    if ix1 is not None:
        w, b = get_colors(ix1, iy1, ix2, iy2)
        white -= b
        black += b
    w, b = get_colors(bx1, by1, bx2, by2)
    white -= w
    black += w
    print(white, black)

t = int(input())
for i in range(t):
    n, m = map(int, input().split())
    x1, y1, x2, y2 = map(int, input().split())
    x3, y3, x4, y4 = map(int, input().split())
    count_w = n * m // 2 + n * m % 2
    count_g = n * m // 2
    if (x1 + y1) % 2 == 0:
        count_g -= (x2 - x1 + 1) * (y2 - y1 + 1) // 2
        count_w += (x2 - x1 + 1) * (y2 - y1 + 1) // 2
    else:
        count_g -= (x2 - x1 + 1) * (y2 - y1 + 1) // 2 + (x2 - x1 + 1) * (y2 - y1 + 1) % 2
        count_w += (x2 - x1 + 1) * (y2 - y1 + 1) // 2 + (x2 - x1 + 1) * (y2 - y1 + 1) % 2
    x5 = max(x1, x3)
    x6 = min(x4, x2)
    y5 = max(y1, y3)
    y6 = min(y4, y2)
    if (x3 + y3) % 2 == 1:
        count_g += (x4 - x3 + 1) * (y4 - y3 + 1) // 2
        count_w -= (x4 - x3 + 1) * (y4 - y3 + 1) // 2
    else:
        count_g += (x4 - x3 + 1) * (y4 - y3 + 1) // 2 + (x4 - x3 + 1) * (y4 - y3 + 1) % 2
        count_w -= (x4 - x3 + 1) * (y4 - y3 + 1) // 2 + (x4 - x3 + 1) * (y4 - y3 + 1) % 2
    if (x5 + y5) % 2 == 0 and x5 <= x6 and y5 <= y6:
        count_g += (x6 - x5 + 1) * (y6 - y5 + 1) // 2
        count_w -= (x6 - x5 + 1) * (y6 - y5 + 1) // 2
    elif x5 <= x6 and y5 <= y6:
        count_g += (x6 - x5 + 1) * (y6 - y5 + 1) // 2 + (x6 - x5 + 1) * (y6 - y5 + 1) % 2
        count_w -= (x6 - x5 + 1) * (y6 - y5 + 1) // 2 + (x6 - x5 + 1) * (y6 - y5 + 1) % 2
    print(count_w, count_g)

def getBW(x1, y1, x2, y2):
    if (x2 - x1) % 2 == 1 or (y2 - y1) % 2 == 1:
        return [(y2 + 1 - y1) * (x2 + 1 - x1) // 2, (y2 + 1 - y1) * (x2 + 1 - x1) // 2] 
    else:
        if (x1 % 2 == 0 and y1 % 2 == 0) or (x1 % 2 == 1 and y1 % 2 == 1):
            return [(y2 + 1 - y1) * (x2 + 1 - x1) // 2, 1 + (y2 + 1 - y1) * (x2 + 1 - x1) // 2]
        else:
            return [1 + (y2 + 1 - y1) * (x2 + 1 - x1) // 2, (y2 + 1 - y1) * (x2 + 1 - x1) // 2]

cs = int(input())



for c in range(cs):
    m, n = map(int, input().split())
    BW = getBW(1, 1, n, m)
    x1, y1, x2, y2 = map(int, input().split())
    
    x3, y3, x4, y4 = map(int, input().split())
    
    BW1 = getBW(x1, y1, x2, y2)
    BW2 = getBW(x3, y3, x4, y4)
    BWO =[0, 0]
    #if x1 > x3: (x1, y1, x2, y2), (x3, y3, x4, y4) = (x3, y3, x4, y4), (x1, y1, x2, y2)
    #xO1, xO2 = x1, min(x2, x4)
    xo1 = max(x1, x3)
    xo2 = min(x2, x4)
    yo1 = max(y1, y3)
    yo2 = min(y2, y4)
    if (xo2 >= xo1 and yo2 >= yo1):
        BWO = getBW(xo1, yo1, xo2, yo2)
        '''
    print(BW1)
    print(BW2)
    print(BWO)
    print(BW)'''
    B = BW[0] - BW1[0] + BW2[1] + BWO[0]
    W = BW[1] + BW1[0] - BW2[1] - BWO[0]
    
    print(W, end = " ")
    print(B)

from collections import defaultdict
# from fractions import Fraction
def read_line():
    return [int(x) for x in input().split()]


def solve2(n, m, x1, y1, x2, y2,
                x3, y3, x4, y4):
    def inside(x, y):
        return 1 <= x <= m and 1 <= y <= n

    def col(a, b):
        assert inside(a, b)
        return 'WB'[(a+b)%2]

    d = {}
    for i in range(1, m+1):
        for j in range(1, n+1):
            d[(i, j)] = col(i, j)
    for i in range(x1, x2+1):
        for j in range(y1, y2+1):
            d[(i, j)] = 'W'
    for i in range(x3, x4+1):
        for j in range(y3, y4+1):
            d[(i, j)] = 'B'
    return len([P for P in d if d[P] == 'W']), len([P for P in d if d[P] == 'B'])

def rnd_test():
    from random import randint
    n = randint(1, 50)
    m = randint(1, 50)
    x1, x2, x3, x4 = [randint(1, m) for _ in range(4)]
    y1, y2, y3, y4 = [randint(1, n) for _ in range(4)]
    x1, x2 = min(x1, x2), max(x1, x2)
    y1, y2 = min(y1, y2), max(y1, y2)
    x3, x4 = min(x3, x4), max(x3, x4)
    y3, y4 = min(y3, y4), max(y3, y4)
    assert solve(n, m, x1, y1, x2, y2,
                x3, y3, x4, y4) == solve2(n, m, x1, y1, x2, y2,
                x3, y3, x4, y4)


            
def solve(n, m, x1, y1, x2, y2,
                x3, y3, x4, y4):

    def inside(x, y):
        return 1 <= x <= m and 1 <= y <= n

    def col(a, b):
        assert inside(a, b)
        return 'WB'[(a+b)%2]

    def cols(x1, y1, x2, y2):
        assert inside(x1, y1) and inside(x2, y2)
        assert x1 <= x2 and y1 <= y2
        w, h = x2+1-x1, y2+1-y1
        if w % 2 == 0 or h % 2 == 0:
            return w*h // 2, w*h // 2
        else:
            WH, BL = w*h // 2, w*h // 2
            if col(x1, y1) == 'W':
                WH += 1
            else: BL += 1
            return WH, BL

    def overlap():
        X1 = max(x1, x3)
        X2 = min(x2, x4)
        Y1 = max(y1, y3)
        Y2 = min(y2, y4)
        if X1 > X2 or Y1 > Y2: return None
        return X1, Y1, X2, Y2

    tot_wh, tot_bl = cols(1, 1, m, n)
    # print("Starting cols: {} wh, {} bl".format(tot_wh, tot_bl))
    A_wh, A_bl = cols(x1, y1, x2, y2)
    ovrlp = overlap()
    if ovrlp is not None:
        O_wh, O_bl = cols(*ovrlp)
        assert A_wh >= O_wh and A_bl >= O_bl
        A_wh -= O_wh
        A_bl -= O_bl
        #print("Overlap cols: {} wh, {} bl".format(O_wh, O_bl))
    # print("White rect cols: {} wh, {} bl".format(A_wh, A_bl))
    B_wh, B_bl = cols(x3, y3, x4, y4)
    #print("Black rect cols: {} wh, {} bl".format(B_wh, B_bl))

    # Paint A white:
    tot_wh += A_bl
    tot_bl -= A_bl

    # Paint B black:
    tot_wh -= B_wh
    tot_bl += B_wh
    return(tot_wh, tot_bl)

# for _ in range(2000):
#     rnd_test()
# print("tested")
t = int(input())

for _ in range(t):
    n, m = read_line()
    x1, y1, x2, y2 = read_line()
    x3, y3, x4, y4 = read_line()
    print(*solve(n, m, x1, y1, x2, y2, x3, y3, x4, y4))


def wb(n,m,flip=False):
    w = b = n*m // 2
    if n%2 == 1 and m %2 == 1:
        w += 1
    if flip:
        return b,w
    else:
        return w,b

t = int(input())
for tt in range(t):
    n,m = map(int, input().split())
    x1,y1,x2,y2 = map(int, input().split())
    x3,y3,x4,y4 = map(int, input().split())
    x5 = max(x1,x3)
    x6 = min(x2,x4)
    y5 = max(y1,y3)
    y6 = min(y2,y4)
    ov = False
    if x6-x5 >= 0 and y6-y5 >= 0:
        ov = True
    w,b = wb(n,m)
    wm,bm = wb(x2-x1+1, y2-y1+1, (x1+y1)%2==1)
    wd,bd = wb(x4-x3+1, y4-y3+1, (x3+y3)%2==1)
    if ov:
        wo,bo = wb(x6-x5+1, y6-y5+1, (x5+y5)%2==1)
    else:
        wo,bo = 0,0
    # print('w, b', w, b)
    # print('wm, bm', wm, bm)
    # print('wd, bd', wd, bd)
    # print('wo, bo', wo, bo)
    w = w+bm-wd-bo
    b = b-bm+wd+bo
    print(w,b)

''' CODED WITH LOVE BY SATYAM KUMAR '''


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left,bisect,bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**27)  # new thread will get stack of such size

printHeap = str()
memory_constrained = False
P = 10**9+7
import sys
sys.setrecursionlimit(10000000)

class Operation:
    def __init__(self, name, function, function_on_equal, neutral_value=0):
        self.name = name
        self.f = function
        self.f_on_equal = function_on_equal
def add_multiple(x, count):
    return x * count
def min_multiple(x, count):
    return x
def max_multiple(x, count):
    return x
sum_operation = Operation("sum", sum, add_multiple, 0)
min_operation = Operation("min", min, min_multiple, 1e9)
max_operation = Operation("max", max, max_multiple, -1e9)
class SegmentTree:
    def __init__(self,
                 array,
                 operations=[sum_operation, min_operation, max_operation]):
        self.array = array
        if type(operations) != list:
            raise TypeError("operations must be a list")
        self.operations = {}
        for op in operations:
            self.operations[op.name] = op
        self.root = SegmentTreeNode(0, len(array) - 1, self)
    def query(self, start, end, operation_name):
        if self.operations.get(operation_name) == None:
            raise Exception("This operation is not available")
        return self.root._query(start, end, self.operations[operation_name])
    def summary(self):
        return self.root.values
    def update(self, position, value):
        self.root._update(position, value)
    def update_range(self, start, end, value):
        self.root._update_range(start, end, value)
    def __repr__(self):
        return self.root.__repr__()
class SegmentTreeNode:
    def __init__(self, start, end, segment_tree):
        self.range = (start, end)
        self.parent_tree = segment_tree
        self.range_value = None
        self.values = {}
        self.left = None
        self.right = None
        if start == end:
            self._sync()
            return
        self.left = SegmentTreeNode(start, start + (end - start) // 2,
                                    segment_tree)
        self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end,
                                     segment_tree)
        self._sync()
    def _query(self, start, end, operation):
        if end < self.range[0] or start > self.range[1]:
            return None
        if start <= self.range[0] and self.range[1] <= end:
            return self.values[operation.name]
        self._push()
        left_res = self.left._query(start, end,
                                    operation) if self.left else None
        right_res = self.right._query(start, end,
                                      operation) if self.right else None
        if left_res is None:
            return right_res
        if right_res is None:
            return left_res
        return operation.f([left_res, right_res])
    def _update(self, position, value):
        if position < self.range[0] or position > self.range[1]:
            return
        if position == self.range[0] and self.range[1] == position:
            self.parent_tree.array[position] = value
            self._sync()
            return
        self._push()
        self.left._update(position, value)
        self.right._update(position, value)
        self._sync()
    def _update_range(self, start, end, value):
        if end < self.range[0] or start > self.range[1]:
            return
        if start <= self.range[0] and self.range[1] <= end:
            self.range_value = value
            self._sync()
            return
        self._push()
        self.left._update_range(start, end, value)
        self.right._update_range(start, end, value)
        self._sync()
    def _sync(self):
        if self.range[0] == self.range[1]:
            for op in self.parent_tree.operations.values():
                current_value = self.parent_tree.array[self.range[0]]
                if self.range_value is not None:
                    current_value = self.range_value
                self.values[op.name] = op.f([current_value])
        else:
            for op in self.parent_tree.operations.values():
                result = op.f(
                    [self.left.values[op.name], self.right.values[op.name]])
                if self.range_value is not None:
                    bound_length = self.range[1] - self.range[0] + 1
                    result = op.f_on_equal(self.range_value, bound_length)
                self.values[op.name] = result
    def _push(self):
        if self.range_value is None:
            return
        if self.left:
            self.left.range_value = self.range_value
            self.right.range_value = self.range_value
            self.left._sync()
            self.right._sync()
            self.range_value = None
    def __repr__(self):
        ans = "({}, {}): {}\n".format(self.range[0], self.range[1],
                                      self.values)
        if self.left:
            ans += self.left.__repr__()
        if self.right:
            ans += self.right.__repr__()
        return ans

def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")

def primeFactors(n): #n**0.5 complex 
    factors = dict()
    for i in range(2,math.ceil(math.sqrt(n))+1):  
        while n % i== 0: 
            if i in factors:
                factors[i]+=1
            else: factors[i]=1
            n = n // i 
    if n>2:
        factors[n]=1
    return (factors)
    
def isprime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True

def test_print(*args):
    if testingMode:
        print(args)

def display_list(list1, sep=" "):
    stdout.write(sep.join(map(str, list1)) + "\n")

def get_int():
    return int(stdin.readline().strip())

def get_tuple():
    return map(int, stdin.readline().split())

def get_list():
    return list(map(int, stdin.readline().split()))

memory = dict()
def clear_cache():
    nonlocal memory
    memory = dict()
def cached_fn(fn, *args):
    nonlocal memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result


# -------------------------------------------------------------- MAIN PROGRAM
TestCases = True
testingMode = False
optimiseForReccursion = False #Can not be used clubbed with TestCases
def getWhiteBlack(l1,r1,l2,r2):
    columns = (r2-r1+1)*(l2-l1+1)
    if columns%2==0:
        return columns//2,columns//2
    if (l1+r1)%2!=0:
        return columns//2, int((columns//2)+1)  
    else: return int((columns//2) + 1), columns//2
            

def main():
    n,m= get_tuple()
    wl1,wr1,wl2,wr2 = get_tuple()
    bl1,br1,bl2,br2 = get_tuple()
    #print(getWhiteBlack(1,1,m,n))
    whites, blacks = getWhiteBlack(1,1,m,n)
    fw,fb = getWhiteBlack(wl1,wr1,wl2,wr2)
    #print(getWhiteBlack(wl1,wr1,wl2,wr2))
    sw,sb = getWhiteBlack(bl1,br1,bl2,br2)
    #print(getWhiteBlack(bl1,br1,bl2,br2))
    il1 = max(wl1,bl1)
    ir1 = max(wr1,br1)
    il2 = min(wl2,bl2)
    ir2 = min(wr2,br2)
    whites+=fb-sw
    blacks+=sw-fb
    #print(whites,blacks)
    if il1<=il2 and ir1<=ir2:
        # Intersectoi
        #print(getWhiteBlack(il1,ir1,il2,ir2))
        iw,ib = getWhiteBlack(il1,ir1,il2,ir2)
        
        whites-= ib
        blacks+= ib
    print(whites,blacks)
        


        
            


# --------------------------------------------------------------------- END


if TestCases: 
    for _ in range(get_int()): 
        cProfile.run('main()') if testingMode else main() 
else: (cProfile.run('main()') if testingMode else main()) if not optimiseForReccursion else threading.Thread(target=main).start()

# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import itertools
import sys

"""
created by shhuan at 2018/11/24 15:29

"""

T = int(input())


def interact(rect1, rect2):
    x1, y1, x2, y2 = rect1
    x3, y3, x4, y4 = rect2

    ans = (-1, -1, -1, -1)
    if x2 < x3 or x4 < x1:
        return 0, ans
    if y2 < y3 or y4 < y1:
        return 0, ans

    ans = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))

    return area(ans), ans


def area(rect):
    return (rect[2] - rect[0] + 1) * (rect[3] - rect[1] + 1)


def winrect(rect):
    a = area(rect)
    if a % 2 == 0:
        return a // 2

    x1, y1, x2, y2 = rect
    e1, e2 = x1 % 2 == 0, y1 % 2 == 0
    ow = (e1 and e2) or (not e1 and not e2)
    return a // 2 + 1 if ow else a // 2

ans = []
for ti in range(T):
    N, M = map(int, input().split())
    x1, y1, x2, y2 = map(int, input().split())
    x3, y3, x4, y4 = map(int, input().split())

    w = winrect((1, 1, N, M))
    a, b = (x1, y1, x2, y2), (x3, y3, x4, y4)
    s, c = interact(a, b)
    if s == 0:
        w -= winrect(a) + winrect(b)
        w += area(a)
    elif s == area(a):
        w -= winrect(b)
    elif s == area(b):
        w -= winrect(b)
        w += area(a) - area(b) - (winrect(a) - winrect(b))
    else:
        w += area(a) - winrect(a)
        w -= winrect(b)
        w -= area(c) - winrect(c)

    ans.append((w, N*M-w))

print('\n'.join(['{} {}'.format(a, b) for a, b in ans]))

def black_count(x, y):
	total = x * y
	return total // 2


def black_count2(a, b, c, d):
	return black_count(c, d) - black_count(a-1, d) - black_count(c, b-1) + black_count(a-1, b-1)

def white_count2(a, b, c, d):
	total = (c - a + 1) * (d - b + 1)
	return total - black_count2(a, b, c, d)


def intersection(a, b, c, d, x, y):
	if x < a or y < b:
		return None
	x = min(x, c)
	y = min(y, d)
	return (a, b, x, y)

def intersection2(a1, b1, c1, d1, a2, b2, c2, d2):
	if b1 > d2 or a1 > c2:
		return None
	if b2 > d1 or a2 > c1:
		return None

	a = max(a1, a2)
	b = max(b1, b2)
	c = min(c1, c2)
	d = min(d1, d2)
	return (a, b, c, d)


def solve(n, m, W, B):
	total = n * m
	whites = total - black_count(n, m)
	whites += black_count2(*W)
	whites -= white_count2(*B)
	I = intersection2(*W, *B)
	if I:
		whites -= black_count2(*I)
	blacks = n * m - whites
	return whites, blacks

def main():
	t = int(input())
	for _ in range(t):
		n, m = list(map(int, input().split()))
		W = list(int(i) for i in input().split())
		B = list(int(i) for i in input().split())
		w, b = solve(n, m, W, B)
		print(w, b)


def __starting_point():
	main()

__starting_point()

def mi():
	return list(map(int, input().split()))

for _ in range(int(input())):
	r,c = mi()
	y1,x1,y2,x2 = mi()
	y3,x3,y4,x4 = mi()
	#(col,row)
	ts = r*c
	if ts%2:
		i_w = (ts+1)//2
	else:
		i_w = ts//2
	i_b = ts-i_w
	ts1 = (x2-x1+1)*(y2-y1+1)
	ts2 = (x4-x3+1)*(y4-y3+1)
	if (x1+y1)%2==0:
		temp1 = (ts1+1)//2
		r1_b = ts1-temp1
	else:
		r1_b = ts1-ts1//2
	if (x3+y3)%2==0:
		temp2 = (ts2+1)//2
		r2_w = temp2
	else:
		r2_w = ts2//2
	x5 = max(x1, x3)
	y5 = max(y1, y3)
	x6 = min(x2, x4)
	y6 = min(y2, y4)
	if x5>x6 or y5>y6:
		i_b-=r1_b
		i_w+=r1_b
		i_w-=r2_w
		i_b+=r2_w
		print(i_w, i_b)
		continue
	x7 = x5
	y7 = y6
	x8 = x6
	y8 = y5
	y7,y8=y8,y7
	ts3 = (abs(x7-x8)+1)*(abs(y7-y8)+1)
	if (x7+y7)%2==0:
		temp3 = (ts3+1)//2
	else:
		temp3 = ts3//2
	c_b = ts3-temp3
	i_b-=r1_b
	i_w+=r1_b
	#print ("LOL", i_w, i_b)
	i_w-=r2_w
	i_b+=r2_w
	#print ("LOL", i_w, i_b)
	i_b+=c_b
	i_w-=c_b
	print(i_w, i_b)
'''
5
2 2
1 1 2 2
1 1 2 2
3 4
2 2 3 2
3 1 4 3
1 5
1 1 5 1
3 1 5 1
4 4
1 1 4 2
1 3 4 4
3 4
1 2 4 2
2 1 3 3
'''


import sys
input = sys.stdin.readline

testcase=int(input())
T=[list(map(int,input().split())) for i in range(testcase*3)]
#n,m=map(int,input().split())
#WHITE=list(map(int,input().split()))
#BLACK=list(map(int,input().split()))

def COMMON(WHITE,BLACK):
    x1,y1,x2,y2=WHITE
    x3,y3,x4,y4=BLACK
    return (max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4))

def BtoW(WHITE):
    x1,y1,x2,y2=WHITE
    if (x1+y1)%2==0:
        return (x2-x1+1)*(y2-y1+1)//2
    else:
        return (x2-x1+1)*(y2-y1+1)-(x2-x1+1)*(y2-y1+1)//2
        
def WtoB(BLACK):
    x1,y1,x2,y2=BLACK
    if (x1+y1)%2==1:
        return (x2-x1+1)*(y2-y1+1)//2
    else:
        return (x2-x1+1)*(y2-y1+1)-(x2-x1+1)*(y2-y1+1)//2
        
for test in range(testcase):
    n,m=T[test*3]
    WHITE=T[test*3+1]
    BLACK=T[test*3+2]

    ANSB=n*m//2
    ANSW=n*m-ANSB

    #print(ANSB,ANSW,end="!")

    WHITE2=COMMON(WHITE,BLACK)

    k=BtoW(WHITE)
    ANSB-=k
    ANSW+=k

    #print(ANSB,ANSW,end="!")
    
    #print(x5,y5,x6,y6)
    if WHITE2[0]>WHITE2[2] or WHITE2[1]>WHITE2[3]:#共通部なし
        True
    else:
        l=BtoW(WHITE2)
        ANSB+=l
        ANSW-=l

    #print(ANSB,ANSW,end="!")

    m=WtoB(BLACK)

    ANSB+=m
    ANSW-=m

    print(ANSW,ANSB)

    
        
    


def whb(a,b,c,d):
    dim = (c-a+1)*(d-b+1)
    col1 = dim//2
    col2 = dim-col1
    if (a+b)%2==0:
        return [col2, col1]
    else:
        return [col1, col2]

def insegment(a, b, a1, b1):
    li = [[a,1], [b,1], [a1,2], [b1,2]]
    li.sort()
    if li[0][1] == li[1][1]:
        if li[1][0] == li[2][0]:
            return [li[1][0], li[2][0]]
        else:
            return -1
    else:
        return [li[1][0], li[2][0]]

def inrect(a,b,c,d,a1,b1,c1,d1):
    xra = insegment(a,c,a1,c1)
    yra = insegment(b,d,b1,d1)
    if xra==-1 or yra==-1:
        return -1
    else:
        return [xra[0], yra[0], xra[1], yra[1]]

q = int(input())
for quer in range(q):
    [n, m] = [int(i) for i in input().split()]
    [x1, y1, x2, y2] = [int(i) for i in input().split()]
    [x3, y3, x4, y4] = [int(i) for i in input().split()]
    [white, black] = whb(1,1,n,m)
    [w1, b1] = whb(x1, y1, x2, y2)
    [w2, b2] = whb(x3, y3, x4, y4)
    black+= w2-b1
    white+= b1-w2
    inter = inrect(x1, y1, x2, y2, x3, y3, x4, y4)
    if type(inter)==list:
        [w3, b3] = whb(inter[0], inter[1],inter[2], inter[3])
        black += b3
        white -= b3
    print(white, black)

def fis(sq):
    if sq[2] < sq[0] or sq[3] < sq[1]:
        return [0, 0]
    sc = (sq[0] + sq[1]) % 2
    fc = (sq[2] + sq[3]) % 2
    sxl = sq[2] - sq[0] + 1
    syl = sq[3] - sq[1] + 1
    hf = (sxl * syl) // 2
    cp = -1
    if sc == fc and (sxl+syl) % 2 == 0 and sxl % 2 == 1:
        cp = sc
    return([hf + (1 if cp == 0 else 0), hf + (1 if cp == 1 else 0)])

t = int(input())
for i in range(t):
    n, m = [int(x) for x in input().split()]
    wco = [int(x) for x in input().split()]
    bco = [int(x) for x in input().split()]
    wf, bf = fis([1, 1, m, n])
    btw = fis(wco)[1]
    wtb = fis(bco)[0]
    bnac = [max(wco[0], bco[0]), max(wco[1], bco[1]), min(wco[2], bco[2]), min(wco[3], bco[3])]
    bna = fis(bnac)[1]
    print(wf+btw-wtb-bna, bf+wtb-btw+bna)


def solve(n, m, white, black):
	w, b = tiles(1, 1, m, n)
	_, b2w = tiles(*white)
	w2b, _ = tiles(*black)

	w += b2w
	b -= b2w
	w -= w2b
	b += w2b

	x1, y1 , x2, y2 = max(white[0], black[0]), max(white[1], black[1]), min(white[2], black[2]), min(white[3], black[3])

	if (x1 <= x2 and y1 <= y2):
		_, b2 = tiles(x1, y1, x2, y2)
		w -= b2
		b += b2 

	return w, b

def tiles(x1, y1, x2, y2):
	n = y2 - y1 + 1
	m = x2 - x1 + 1
	black = (x1 + y1) % 2
	w = (n//2) * m  + (m+(not black))//2 * (n%2)
	b = (n//2) * m  + (m+(black))//2 * (n%2)
	return w, b

def read(): return list(map(int, input().split()))

q = int(input())
for _ in range(q):
	print(*solve(*read(), read(), read()), sep=' ')


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
import sys
import math
MAX = sys.maxsize
MAXN = 10**6+10
MOD = 10**9+7
def isprime(n):
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2: 
        return True    
    if not n & 1: 
        return False
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False
    return True

def mhd(a,b,x,y):
    return abs(a-x)+abs(b-y)

def numIN():
    return(list(map(int,sys.stdin.readline().strip().split())))

def charIN():
    return(sys.stdin.readline().strip().split())


def solve(x1,y1,x2,y2):
	xa = x2-x1+1
	ya = y2-y1+1

	area = xa*ya

	if(x1+y1)%2==0:
		if area%2:
			tw = area//2+1
		else:
			tw = area//2
	else:
		tw = area//2

	return area-tw,tw

for _ in range(int(input())):
	n,m = numIN()
	black = (n*m)//2
	white = (n*m)-black
	x1,y1,x2,y2 = numIN()
	x3,y3,x4,y4 = numIN()
	#print('#1',white,black)
	b1,w1 = solve(x1,y1,x2,y2)
	black-=b1
	white+=b1
	#print('#2',white,black)
	b2,w2 = solve(x3,y3,x4,y4)
	black+=w2
	white-=w2
	#print('#3',white,black)
	x5 = max(x1,x3)
	y5 = max(y1,y3)
	x6 = min(x2,x4)
	y6 = min(y2,y4)
	#print(x5,y5,x6,y6)
	ar = (x6-x5+1)*(y6-y5+1)
	b3,w3 = solve(x5,y5,x6,y6)
	#print('abc',b3,w3)
	if x5<=x6 and y5<=y6:
		black+=b3
		white-=b3
	print(white,black)







tc_count = int(input())

ans = []

for i in range(tc_count):
  size = list(map(int, input().split()))
  w = size[1]
  h = size[0]
  white = list(map(int, input().split()))
  black = list(map(int, input().split()))
  black_count = (w * h) // 2
  white_count = (w * h) - black_count

  white_area = (white[3] - white[1] + 1) * (white[2] - white[0] + 1)
  if (white[0] + white[1]) % 2 == 0:
    become_white = (white_area // 2)
  else:
    become_white = white_area - (white_area // 2)
  black_count = black_count - become_white
  white_count = white_count + become_white

  black_area = (black[3] - black[1] + 1) * (black[2] - black[0] + 1)
  if (black[0] + black[1]) % 2 == 0:
    become_black = black_area - (black_area // 2)
  else:
    become_black = black_area // 2
  white_count = white_count - become_black
  black_count = black_count + become_black

  left_x = max(black[0], white[0])
  left_y = max(black[1], white[1])
  right_x = min(black[2], white[2])
  right_y = min(black[3], white[3])
  orig_b = 0
  if left_x <= right_x and left_y <= right_y:
    rect_count = (right_x - left_x + 1) * (right_y - left_y + 1)
    orig_b = rect_count // 2 if (left_x + left_y) % 2 == 0 else rect_count - (rect_count // 2)
  white_count = white_count - orig_b
  black_count = black_count + orig_b
  ans.append(str(white_count)+ " " + str(black_count))

for an in ans:
  print(an)


import math

def duh0(x1,x2,x3,x4, y1,y2,y3,y4, midonly=False):
    W = B = 0
    if (x3 <= x2) and (x1 <= x4):
        # print(1)
        w,b = duh1(max(x1,x3), min(x2,x4),
            y1,y2,y3,y4, midonly)
        W += w
        B += b
    if midonly:
        return (W,B)

    if (x1 < x3):
        # print(3)
        w,b = duh1(x1, min(x2,x3-1),
            y1,y2,y3,y4)
        W += w
        B += b
    if (x4 < x2):
        # print(7)
        w,b = duh1(max(x1,x4+1), x2,
            y1,y2,y3,y4)
        W += w
        B += b
    return (W,B)


def duh1(xa, xb, y1, y2, y3, y4, midonly=False):
    W = B = 0
    if (y3 <= y2) and (y1 <= y4):
        # print("  ", 1, y1, y2, y3, y4)
        w,b = cnt(xa, xb, max(y1, y3), min(y2, y4))
        W += w
        B += b
    if midonly:
        return (W,B)

    if (y1 < y3):
        # print("  ", 4)
        w,b = cnt(xa, xb, y1, min(y2, y3-1))
        W += w
        B += b
    if (y4 < y2):
        # print("  ", 8)
        w,b = cnt(xa, xb, max(y1, y4+1), y2)
        W += w
        B += b
    return (W,B)


def cnt(xa, xb, ya, yb):
    m = xb - xa + 1
    n = yb - ya + 1
    W = m*n
    B = W//2
    W -= B
    return (B,W) if (xa+ya)&1 else (W,B)

def solve(n, m,
            x1, y1, x2, y2,
            x3, y3, x4, y4):
    st = cnt(1, m, 1, n)

    whi = duh0(x1,x2,x3,x4, y1,y2,y3,y4)
    its = duh0(x1,x2,x3,x4, y1,y2,y3,y4, midonly=True)
    bla = cnt(x3, x4, y3, y4)

    W = st[0] + whi[1] - its[1] - bla[0]
    B = st[1] - whi[1] + its[1] + bla[0]

    # print(st, whi, its, bla, sep="  ")

    print(W,B)



###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

def __starting_point():
    ipt = intRead()
    t = next(ipt)
    while t:
        t -= 1
        n = next(ipt)
        m = next(ipt)
        x1 = next(ipt)
        y1 = next(ipt)
        x2 = next(ipt)
        y2 = next(ipt)
        x3 = next(ipt)
        y3 = next(ipt)
        x4 = next(ipt)
        y4 = next(ipt)
        solve(n, m,
            x1, y1, x2, y2,
            x3, y3, x4, y4)

__starting_point()