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: MEDIUM

Solutions:
from sys import stdin
input = stdin.buffer.readline

def func(x1, y1, x2, y2):
	x = (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	y = (x2 - x1 + 1) * (y2 - y1 + 1) - x
	if (x1 + y1) % 2 == 0:
		w = max(x, y)
		b = min(x, y)
	else:
		w = min(x, y)
		b = max(x, y)
	return (w, b)
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())
	tb = n * m // 2
	tw = n * m - tb
	(r1w, r1b) = func(x1, y1, x2, y2)
	(r2w, r2b) = func(x3, y3, x4, y4)
	zx1 = max(x1, x3)
	zy1 = max(y1, y3)
	zx2 = min(x2, x4)
	zy2 = min(y2, y4)
	if zx1 > zx2 or zy1 > zy2:
		(cw, cb) = (0, 0)
	else:
		(cw, cb) = func(zx1, zy1, zx2, zy2)
	rem_w = tw - r1w - r2w + cw
	rem_b = tb - r1b - r2b + cb
	w = rem_w + r1w + r1b - cw - cb
	b = rem_b + r2w + r2b
	print(w, b)


t = int(input())

def calc(p1, q1, p2, q2):
	(h, w) = (p2 - p1 + 1, q2 - q1 + 1)
	if h <= 0 or w <= 0:
		return (0, 0)
	wh = h * w // 2
	bl = h * w // 2
	if h % 2 != 0 and w % 2 != 0:
		if p1 % 2 == q1 % 2:
			wh += 1
		else:
			bl += 1
	return (wh, bl)
for i in range(t):
	(H, W) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	if H % 2 != 0 and W % 2 != 0:
		white = H * W // 2 + 1
		black = H * W // 2
	else:
		white = H * W // 2
		black = H * W // 2
	(w1, b1) = calc(x1, y1, x2, y2)
	white += b1
	black -= b1
	(w2, b2) = calc(x3, y3, x4, y4)
	white -= w2
	black += w2
	(p, q) = (max(x1, x3), max(y1, y3))
	(r, s) = (min(x2, x4), min(y2, y4))
	(w3, b3) = calc(p, q, r, s)
	white -= b3
	black += b3
	print(white, black)


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
	(x1, y1, x2, y2) = rect
	ra = area(rect)
	(more, less) = ((ra + 1) // 2, ra // 2)
	if (x1 + y1) % 2 == 0:
		return more
	else:
		return less

def intersect_rects(r1, r2):
	out = []
	for (i, a, b) in zip(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 math
import collections
import bisect
import heapq
import time
import itertools
import sys
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]))


from math import ceil
t = int(input())
for tc in range(t):
	(n, m) = map(int, input().split())
	w = n * m - (n * m >> 1)
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	sz = (x2 - x1 + 1) * (y2 - y1 + 1)
	tw = sz >> 1
	if sz & 1 > 0 and x1 + y1 & 1 > 0:
		tw = sz - tw
	sz = (x4 - x3 + 1) * (y4 - y3 + 1)
	tb = sz >> 1
	if sz & 1 > 0 and x3 + y3 & 1 == 0:
		tb = sz - tb
	x1 = max(x1, x3)
	x2 = min(x2, x4)
	y1 = max(y1, y3)
	y2 = min(y2, y4)
	sz = (x2 - x1 + 1) * (y2 - y1 + 1)
	ctw = sz >> 1
	if sz & 1 > 0 and x1 + y1 & 1 > 0:
		ctw = sz - ctw
	if x1 > x2 or y1 > y2:
		ctw = 0
	w += tw - tb - ctw
	print(w, n * m - w)


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 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()
	(b1, w1) = solve(x1, y1, x2, y2)
	black -= b1
	white += b1
	(b2, w2) = solve(x3, y3, x4, y4)
	black += w2
	white -= w2
	x5 = max(x1, x3)
	y5 = max(y1, y3)
	x6 = min(x2, x4)
	y6 = min(y2, y4)
	ar = (x6 - x5 + 1) * (y6 - y5 + 1)
	(b3, w3) = solve(x5, y5, x6, y6)
	if x5 <= x6 and y5 <= y6:
		black += b3
		white -= b3
	print(white, black)


t = int(input())

def countW(x, y):
	if x <= 0 or y <= 0:
		return 0
	res = (x + 1) // 2 * ((y + 1) // 2) + x // 2 * (y // 2)
	return res

def countRectW(x1, y1, x2, y2):
	if x1 > x2 or y1 > y2:
		return 0
	return countW(x2, y2) - countW(x1 - 1, y2) - countW(x2, y1 - 1) + countW(x1 - 1, y1 - 1)

def countRectB(x1, y1, x2, y2):
	if x1 > x2 or y1 > y2:
		return 0
	w = x2 - x1 + 1
	h = y2 - y1 + 1
	return w * h - countRectW(x1, y1, x2, y2)

def overlap(x1, y1, x2, y2, x3, y3, x4, y4):
	xbl = max(x1, x3)
	ybl = max(y1, y3)
	xtr = min(x2, x4)
	ytr = min(y2, y4)
	return (xbl, ybl, xtr, ytr)
for _ 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 = countW(m, n)
	B = m * n - W
	(xbl, ybl, xtr, ytr) = overlap(x1, y1, x2, y2, x3, y3, x4, y4)
	w1 = countRectW(x1, y1, x2, y2) - countRectW(xbl, ybl, xtr, ytr)
	b1 = countRectB(x1, y1, x2, y2) - countRectB(xbl, ybl, xtr, ytr)
	W += b1
	B -= b1
	w2 = countRectW(x3, y3, x4, y4)
	b1 = countRectB(x3, y3, x4, y4)
	W -= w2
	B += w2
	print(W, B)


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)


from sys import stdin, stdout
import math
import heapq
from itertools import accumulate

def overlap(r1, r2):
	left = max(r1[0], r2[0])
	right = min(r1[1], r2[1])
	bottom = max(r1[2], r2[2])
	top = min(r1[3], r2[3])
	if left <= right and bottom <= top:
		return [left, bottom, right, top]
	else:
		return []

def paint(r):
	N = r[2] - r[0] + 1
	M = r[3] - r[1] + 1
	B = 0
	W = 0
	if N % 2 == 0:
		B = N * M // 2
		W = B
	else:
		B = (N - 1) * M // 2
		W = B
		d = M // 2
		B += d
		W += M - d
	if (r[0] + r[1]) % 2 == 1:
		(B, W) = (W, B)
	return [W, B]

def area(r):
	N = r[2] - r[0] + 1
	M = r[3] - r[1] + 1
	return N * M
Q = int(input())
for i in range(Q):
	(N, M) = [int(x) for x in stdin.readline().split()]
	(x1, y1, x2, y2) = [int(x) for x in stdin.readline().split()]
	(x3, y3, x4, y4) = [int(x) for x in stdin.readline().split()]
	r1 = [x1, x2, y1, y2]
	r2 = [x3, x4, y3, y4]
	r3 = overlap(r1, r2)
	B = 0
	W = 0
	if N % 2 == 0:
		B = N * M // 2
		W = B
	else:
		B = (N - 1) * M // 2
		W = B
		d = M // 2
		B += d
		W += M - d
	r1 = [x1, y1, x2, y2]
	r2 = [x3, y3, x4, y4]
	p1 = paint(r1)
	p2 = paint(r2)
	if r3:
		p3 = paint(r3)
	B -= p1[1]
	B -= p2[1]
	W -= p1[0]
	W -= p2[0]
	if r3:
		B += p3[1]
		W += p3[0]
	if r3:
		W += area(r1) - area(r3)
	else:
		W += area(r1)
	B += area(r2)
	print(W, B)


t = int(input())

def get(tn, tm, is_white):
	less = tn * tm // 2
	more = tn * tm - less
	if is_white == 1:
		return (more, less)
	else:
		return (less, more)

def intersection(x1, y1, x2, y2, x3, y3, x4, y4):
	x5 = max(x1, x3)
	y5 = max(y1, y3)
	x6 = min(x2, x4)
	y6 = min(y2, y4)
	return x5 <= x6 and y5 <= y6
for _ 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())
	white = black = 0
	(white, black) = get(n, m, 1)
	(w1, b1) = get(x2 - x1 + 1, y2 - y1 + 1, (x1 + y1) % 2 == 0)
	(w2, b2) = get(x4 - x3 + 1, y4 - y3 + 1, (x3 + y3) % 2 == 0)
	white += b1
	black -= b1
	white -= w2
	black += w2
	if intersection(x1, y1, x2, y2, x3, y3, x4, y4):
		x5 = max(x1, x3)
		y5 = max(y1, y3)
		x6 = min(x2, x4)
		y6 = min(y2, y4)
		(w3, b3) = get(x6 - x5 + 1, y6 - y5 + 1, (x5 + y5) % 2 == 0)
		white -= b3
		black += b3
	print(white, black)


import sys, math

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

def quer(x1, y1, x2, y2):
	if x1 > x2 or y1 > y2:
		return [0, 0]
	s = (x2 - (x1 - 1)) * (y2 - (y1 - 1))
	if s % 2 == 0:
		return [s // 2, s // 2]
	if x1 + y1 & 1:
		return [s // 2 + 1, s // 2]
	return [s // 2, s // 2 + 1]

def main():
	q = int(input())
	for i in range(q):
		(n, m) = mp()
		(x1, y1, x2, y2) = mp()
		s = quer(1, 1, n, m)
		s1 = quer(x1, y1, x2, y2)
		s[0] -= s1[0]
		s[1] += s1[0]
		(x3, y3, x4, y4) = mp()
		xmn = max(x1, x3)
		xmx = min(x2, x4)
		ymn = max(y1, y3)
		ymx = min(y2, y4)
		s1 = quer(x3, y3, x4, y4)
		s[0] += s1[1]
		s[1] -= s1[1]
		s1 = quer(xmn, ymn, xmx, ymx)
		s[0] += s1[0]
		s[1] -= s1[0]
		print(*s[::-1])
debug = 0
if debug:
	file = open('input.txt', 'r')
	input = file.readline
main()
if debug:
	file.close()


def count(x, y, p, q, color):
	if x > p or y > q:
		return 0
	ans = (p - x + 1) * (q - y + 1) // 2 + 1
	if (x ^ p | y ^ q | x + y ^ color) & 1:
		ans -= 1
	return ans
n = int(input())
for i in range(n):
	ans = 0
	(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()))
	ans = count(1, 1, n, m, 0)
	ans += count(x1, y1, x2, y2, 1)
	ans -= count(x3, y3, x4, y4, 0)
	ans -= count(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4), 1)
	print(ans, m * n - ans)


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)
threading.stack_size(2 ** 27)
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, 1000000000.0)
max_operation = Operation('max', max, max_multiple, -1000000000.0)

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):
	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):
	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():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result
TestCases = True
testingMode = False
optimiseForReccursion = False

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()
	(whites, blacks) = getWhiteBlack(1, 1, m, n)
	(fw, fb) = getWhiteBlack(wl1, wr1, wl2, wr2)
	(sw, sb) = 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
	if il1 <= il2 and ir1 <= ir2:
		(iw, ib) = getWhiteBlack(il1, ir1, il2, ir2)
		whites -= ib
		blacks += ib
	print(whites, blacks)
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()


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 is_black(x, y):
	return (x + y) % 2 == 1

def is_white(x, y):
	return (x + y) % 2 == 0

def inspect(x1, y1, x2, y2):
	row_size = x2 - x1 + 1
	col_size = y2 - y1 + 1
	temporal_product = row_size * col_size // 2
	if row_size % 2 == 0 or col_size % 2 == 0:
		return (temporal_product, temporal_product)
	elif is_black(x1, y1):
		return (temporal_product + 1, temporal_product)
	return (temporal_product, temporal_product + 1)

def belong(x1, y1, x2, y2, x3, y3, x4, y4):
	return x3 <= x1 and x2 <= x4 and (y3 <= y1) and (y2 <= y4)

def intersection(x1, y1, x2, y2, x3, y3, x4, y4):
	square = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	if square[0] > square[2] or square[1] > square[3]:
		return None
	if belong(*square, x1, y1, x2, y2) or belong(*square, x3, y3, x4, y4):
		return square
	return None
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(black, white) = inspect(1, 1, n, m)
	(t1_black, t1_white) = inspect(x1, y1, x2, y2)
	black -= t1_black
	white += t1_black
	(t2_black, t2_white) = inspect(x3, y3, x4, y4)
	black += t2_white
	white -= t2_white
	intersection_info = intersection(x1, y1, x2, y2, x3, y3, x4, y4)
	if intersection_info:
		(b, w) = inspect(*intersection_info)
		black += b
		white -= b
	print(white, black)


for i in range(int(input())):
	(m, n) = map(int, input().split())
	s0 = s1 = n * m // 2
	if n * m % 2 == 1:
		s0 += 1
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(d1, d2) = (x4 - x3 + 1, y4 - y3 + 1)
	if d1 * d2 % 2 == 1 and (x3 + y3) % 2 == 0:
		s0 -= d1 * d2 // 2 + 1
		s1 += d1 * d2 // 2 + 1
	else:
		s0 -= d1 * d2 // 2
		s1 += d1 * d2 // 2
	a = []
	a.append([1, 1, x3 - 1, y3 - 1])
	a.append([1, y3, x3 - 1, y4])
	a.append([1, y4 + 1, x3 - 1, m])
	a.append([x3, 1, x4, y3 - 1])
	a.append([x3, y4 + 1, x4, m])
	a.append([x4 + 1, 1, n, y3 - 1])
	a.append([x4 + 1, y3, n, y4])
	a.append([x4 + 1, y4 + 1, n, m])
	for b in a:
		(nx1, ny1, nx2, ny2) = (max(b[0], x1), max(b[1], y1), min(b[2], x2), min(b[3], y2))
		if nx1 > nx2 or ny1 > ny2:
			continue
		(d1, d2) = (nx2 - nx1 + 1, ny2 - ny1 + 1)
		if d1 * d2 % 2 == 1 and (nx1 + ny1) % 2 == 1:
			s0 += d1 * d2 // 2 + 1
			s1 -= d1 * d2 // 2 + 1
		else:
			s0 += d1 * d2 // 2
			s1 -= d1 * d2 // 2
	print(s0, s1)


import os, sys
from io import BytesIO, IOBase

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
BUFSIZE = 8192
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
rstr = lambda : input().strip()
rstrs = lambda : [str(x) for x in input().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint = lambda : int(input())
rints = lambda : [int(x) for x in input().split()]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
ceil1 = lambda a, b: (a + b - 1) // b
for _ in range(rint()):
	(n, m) = rints()
	(r1, r2, area) = (rints(), rints(), n * m)
	ans = [area // 2 + (area & 1), area // 2]
	area1 = (r1[2] - r1[0] + 1) * (r1[3] - r1[1] + 1)
	b1 = area1 // 2 + (r1[0] + r1[1] & 1 and area1 & 1)
	ans[0] += b1
	ans[1] -= b1
	area2 = (r2[2] - r2[0] + 1) * (r2[3] - r2[1] + 1)
	w1 = area2 // 2 + (r2[0] + r2[1] & 1 == 0 and area2 & 1)
	ans[0] -= w1
	ans[1] += w1
	ro = [max(r1[0], r2[0]), max(r1[1], r2[1]), min(r1[2], r2[2]), min(r1[3], r2[3])]
	if ro[0] <= ro[2] and ro[1] <= ro[3]:
		area1 = (ro[2] - ro[0] + 1) * (ro[3] - ro[1] + 1)
		b1 = area1 // 2 + (ro[0] + ro[1] & 1 and area1 & 1)
		ans[1] += b1
		ans[0] -= b1
	print(f'{ans[0]} {ans[1]}')


import math

def duh0(x1, x2, x3, x4, y1, y2, y3, y4, midonly=False):
	W = B = 0
	if x3 <= x2 and x1 <= x4:
		(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:
		(w, b) = duh1(x1, min(x2, x3 - 1), y1, y2, y3, y4)
		W += w
		B += b
	if x4 < x2:
		(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:
		(w, b) = cnt(xa, xb, max(y1, y3), min(y2, y4))
		W += w
		B += b
	if midonly:
		return (W, B)
	if y1 < y3:
		(w, b) = cnt(xa, xb, y1, min(y2, y3 - 1))
		W += w
		B += b
	if y4 < y2:
		(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(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
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)


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]
	elif 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]
	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)
	B = BW[0] - BW1[0] + BW2[1] + BWO[0]
	W = BW[1] + BW1[0] - BW2[1] - BWO[0]
	print(W, end=' ')
	print(B)


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())
	init_b = m * n // 2
	init_w = m * n - init_b
	(l, w) = (x2 - x1 + 1, y2 - y1 + 1)
	if (x1 + y1) % 2 == 0:
		w1 = init_w + l * w // 2
		b1 = init_b - l * w // 2
	else:
		w1 = init_w + (l * w - l * w // 2)
		b1 = init_b - (l * w - l * w // 2)
	(l, w) = (x4 - x3 + 1, y4 - y3 + 1)
	if (x3 + y3) % 2 == 0:
		w2 = w1 - (l * w - l * w // 2)
		b2 = b1 + (l * w - l * w // 2)
	else:
		w2 = w1 - l * w // 2
		b2 = b1 + l * w // 2
	bot = max((y1, y3))
	top = min((y2, y4))
	left = max((x1, x3))
	right = min((x2, x4))
	if bot > top or left > right:
		print(w2, b2)
		continue
	(l, w) = (right - left + 1, top - bot + 1)
	if (bot + left) % 2 == 0:
		w3 = w2 - l * w // 2
		b3 = b2 + l * w // 2
	else:
		w3 = w2 - (l * w - l * w // 2)
		b3 = b2 + (l * w - l * w // 2)
	print(w3, b3)


def num_sq(x, y, x2, y2):
	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)


from sys import stdin
from math import ceil

def inter(a, b):
	x1 = [a[0], a[2]]
	y1 = [a[1], a[3]]
	x2 = [b[0], b[2]]
	y2 = [b[1], b[3]]
	if x1[0] == None or x2[0] == None or max(y2) < min(y1) or (max(y1) < min(y2)) or (max(x2) < min(x1)) or (max(x1) < min(x2)):
		return [None] * 4
	x = x1 + x2
	y = y1 + y2
	y.sort()
	x.sort()
	return [x[1], y[1], x[2], y[2]]
cases = int(stdin.readline().strip())

def bl(n, m):
	return ceil(m / 2) * ceil(n / 2) + m // 2 * (n // 2)

def ng(n, m):
	return m // 2 * ceil(n / 2) + ceil(m / 2) * (n // 2)

def trans(a, b, c, d):
	if a == None:
		return (0, 0)
	d1 = a - 1
	d2 = b - 1
	return (c - d1, d - d2)
for case in range(cases):
	(n, m) = map(int, stdin.readline().strip().split())
	blc = bl(n, m)
	ngr = ng(n, m)
	(a1, b1, c1, d1) = map(int, stdin.readline().strip().split())
	(a, b, c, d) = map(int, stdin.readline().strip().split())
	s = inter([a1, b1, c1, d1], [a, b, c, d])
	(n1, m1) = trans(a, b, c, d)
	if (a + b) % 2 == 0:
		ngr += bl(n1, m1)
		y = bl(n1, m1)
	else:
		ngr += ng(n1, m1)
		y = ng(n1, m1)
	(n2, m2) = trans(a1, b1, c1, d1)
	(n3, m3) = trans(s[0], s[1], s[2], s[3])
	if (a1 + b1) % 2 == 0:
		x = ng(n2, m2)
	else:
		x = bl(n2, m2)
	if s[0] == None:
		z = 0
	elif (s[0] + s[1]) % 2 != 0:
		z = ng(n3, m3)
	else:
		z = bl(n3, m3)
	if s[0] == None:
		z1 = 0
	elif (s[0] + s[1]) % 2 == 0:
		z1 = ng(n3, m3)
	else:
		z1 = bl(n3, m3)
	blc += x - n3 * m3 - (y - z)
	print(blc, ngr - (x - z1))


import sys
import random
from itertools import permutations, combinations
from math import sqrt, fabs, ceil
from collections import namedtuple
in_file_path = 'input.txt'
output_file_path = 'output.txt'
SUBMIT = True

def read_num(fin, num_type=int):
	tmp_list = [num_type(x) for x in fin.readline().strip().split()]
	if len(tmp_list) == 1:
		return tmp_list[0]
	else:
		return tuple(tmp_list)

def solve(fin):

	def count_color(x, y, xx, yy):
		if x > xx or y > yy:
			return (0, 0)
		t = (xx - x + 1) * (yy - y + 1)
		if t % 2 == 0:
			return (t // 2, t // 2)
		elif (x + y) % 2 == 0:
			return (t - t // 2, t // 2)
		else:
			return (t // 2, t - t // 2)
	T = read_num(fin)
	for _ in range(0, T):
		(n, m) = read_num(fin)
		(x1, y1, x2, y2) = read_num(fin)
		(x3, y3, x4, y4) = read_num(fin)
		(w, _) = count_color(1, 1, n, m)
		if max(x1, x3) > min(x2, x4) or max(y1, y3) > min(y2, y4):
			(tmp_w, tmp_b) = count_color(x1, y1, x2, y2)
			w += tmp_b
			(tmp_w, tmp_b) = count_color(x3, y3, x4, y4)
			w -= tmp_w
		else:
			(tmp_w, tmp_b) = count_color(x1, y1, x2, y2)
			w += tmp_b
			(tmp_w, tmp_b) = count_color(x3, y3, x4, y4)
			w -= tmp_w
			tmp_x_list = sorted([x1, x2, x3, x4])
			tmp_y_list = sorted([y1, y2, y3, y4])
			(x5, x6) = (tmp_x_list[1], tmp_x_list[2])
			(y5, y6) = (tmp_y_list[1], tmp_y_list[2])
			(tmp_w, tmp_b) = count_color(x5, y5, x6, y6)
			w -= tmp_b
		print(w, n * m - w)
if SUBMIT:
	solve(sys.stdin)
else:
	solve(open(in_file_path, 'r'))


def white_black(a, b, c, d):
	(l, h) = (c - a + 1, d - b + 1)
	total = l * h
	(black, white) = (0, 0)
	if total % 2 == 0:
		return (total // 2, total // 2)
	elif (a + b) % 2 == 0:
		return (total // 2 + 1, total // 2)
	else:
		return (total // 2, total // 2 + 1)

def intersection(x1, y1, x2, y2, x3, y3, x4, y4):
	(a, b, c, d) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	if b > d or a > c:
		return -1
	else:
		return (a, b, c, d)
for _ in range(int(input())):
	(n, m) = tuple(map(int, input().split()))
	(x1, y1, x2, y2) = tuple(map(int, input().split()))
	(x3, y3, x4, y4) = tuple(map(int, input().split()))
	(white, black) = white_black(1, 1, n, m)
	(w, b) = white_black(x1, y1, x2, y2)
	(white, black) = (white - w, black - b)
	white += w + b
	common = intersection(x1, y1, x2, y2, x3, y3, x4, y4)
	if common != -1:
		(w, b) = white_black(*common)
		white -= w + b
		(white, black) = (white + w, black + b)
	(w, b) = white_black(x3, y3, x4, y4)
	(white, black) = (white - w, black - b)
	black += w + b
	print(white, black)


t = int(input())
for _ 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())
	blacks = n * m // 2
	whites = n * m - blacks
	if (x2 - x1) % 2 or (y2 - y1) % 2:
		whites += (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	elif (x1 + y1) % 2 == 0:
		whites += (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	else:
		whites += (x2 - x1 + 1) * (y2 - y1 + 1) // 2 + 1
	blacks = n * m - whites
	if (x4 - x3) % 2 or (y4 - y3) % 2:
		blacks += (x4 - x3 + 1) * (y4 - y3 + 1) // 2
	elif (x3 + y3) % 2 == 1:
		blacks += (x4 - x3 + 1) * (y4 - y3 + 1) // 2
	else:
		blacks += (x4 - x3 + 1) * (y4 - y3 + 1) // 2 + 1
	if x1 <= x4 and x2 >= x3 and (y1 <= y4) and (y2 >= y3):
		x3 = max(x3, x1)
		y3 = max(y3, y1)
		x4 = min(x4, x2)
		y4 = min(y4, y2)
		if (x4 - x3) % 2 or (y4 - y3) % 2:
			blacks += (x4 - x3 + 1) * (y4 - y3 + 1) // 2
		elif (x3 + y3) % 2 == 1:
			blacks += (x4 - x3 + 1) * (y4 - y3 + 1) // 2 + 1
		else:
			blacks += (x4 - x3 + 1) * (y4 - y3 + 1) // 2
	whites = n * m - blacks
	print(whites, blacks)


from math import ceil

def cou(h, w, ld):
	if h % 2 == 0:
		return h // 2 * w
	elif w % 2 == 0:
		return w // 2 * h
	else:
		l1 = ceil(w / 2)
		l2 = l1 - 1
		if ld == 1:
			(l1, l2) = (l2, l1)
		return l1 * (h // 2 + 1) + l2 * (h // 2)

def color(x, y):
	return 0 if (x + y) % 2 == 0 else 1
t = int(input())
answers = []
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())
	white = cou(n, m, 0)
	allColors = [white, n * m - white]
	leftDown = 0 if (x1 + y1) % 2 == 0 else 1
	delta1 = (x2 - x1 + 1) * (y2 - y1 + 1) - cou(x2 - x1 + 1, y2 - y1 + 1, color(x1, y1))
	allColors[0] += delta1
	allColors[1] -= delta1
	delta2 = cou(x4 - x3 + 1, y4 - y3 + 1, color(x3, y3))
	allColors[0] -= delta2
	allColors[1] += delta2
	left = max(x1, x3)
	top = min(y2, y4)
	right = min(x2, x4)
	bottom = max(y1, y3)
	width = right - left + 1
	height = top - bottom + 1
	if width < 1 or height < 1:
		answers.append(allColors)
	else:
		delta3 = width * height - cou(width, height, color(left, bottom))
		allColors[0] -= delta3
		allColors[1] += delta3
		answers.append(allColors)
for i in answers:
	print(*i)


import math
I = lambda : int(input())
ID = lambda : map(int, input().split())
IL = lambda : list(ID())
t = int(input())

def calc(x1, y1, x2, y2):
	x = max(x2 - x1 + 1, 0)
	y = max(y2 - y1 + 1, 0)
	b = w = x * y // 2
	if x % 2 and y % 2:
		if (x1 + y1) % 2:
			b = b + 1
		else:
			w = w + 1
	return (w, b)
for _ 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())
	(fw, fb) = calc(1, 1, n, m)
	(r1w, r1b) = calc(x1, y1, x2, y2)
	(r2w, r2b) = calc(x3, y3, x4, y4)
	(r3w, r3b) = calc(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	w = fw - r2w
	b = fb - r1b + r3b
	w = w + r1b - r3b
	b = b + r2w
	print(w, b)


def color(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 == 0:
			w += 1
		else:
			b += 1
	return (w, b)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(w, b) = color(1, 1, n, m)
	(w1, b1) = color(x1, y1, x2, y2)
	(w2, b2) = color(x3, y3, x4, y4)
	(w3, b3) = color(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	W = w + b1 - w2 - b3
	print(W, n * m - W)


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)


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict

def I():
	return int(sys.stdin.readline())

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

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

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(I()):
	(n, m) = neo()
	(x1, y1, x2, y2) = neo()
	(x3, y3, x4, y4) = neo()
	w = pre(m, n)
	b = m * n - w
	(wc, bc) = count(x1, y1, x2, y2)
	w -= wc
	b -= bc
	w += (x2 - x1 + 1) * (y2 - y1 + 1)
	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()


def siz(a, b, c, d):
	return (c - a + 1) * (d - b + 1)

def whi(a, b, c, d):
	if siz(a, b, c, d) % 2 == 0:
		return siz(a, b, c, d) // 2
	else:
		return siz(a, b, c, d) // 2 + (1 - (a + b) % 2)

def blk(a, b, c, d):
	return siz(a, b, c, d) - whi(a, b, c, d)
t = int(input())
while t > 0:
	t = t - 1
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(x6, y6) = (min(x2, x4), min(y2, y4))
	(x5, y5) = (max(x1, x3), max(y1, y3))
	W = whi(1, 1, m, n)
	B = blk(1, 1, m, n)
	W = W - whi(x1, y1, x2, y2) + siz(x1, y1, x2, y2)
	B = B - blk(x1, y1, x2, y2)
	if x5 > x6 or y5 > y6:
		W = W - whi(x3, y3, x4, y4)
		B = B - blk(x3, y3, x4, y4) + siz(x3, y3, x4, y4)
	else:
		W = W - siz(x5, y5, x6, y6) - (whi(x3, y3, x4, y4) - whi(x5, y5, x6, y6))
		B = B - (blk(x3, y3, x4, y4) - blk(x5, y5, x6, y6)) + siz(x3, y3, x4, y4)
	print(W, B)


from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def digits(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def ceil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def mapin():
	return map(int, input().split())

def help(x1, y1, x2, y2):
	s = (x2 - x1 + 1) * (y2 - y1 + 1)
	if s % 2 == 0:
		return [s // 2, s // 2]
	elif (x1 + y1) % 2 == 0:
		return [s // 2, s // 2 + 1]
	else:
		return [s // 2 + 1, s // 2]
t = int(input())
for _ in range(t):
	(n, m) = mapin()
	(x1, y1, x2, y2) = mapin()
	(x3, y3, x4, y4) = mapin()
	(x5, y5, x6, y6) = (0, 0, 0, 0)
	x5 = max(x1, x3)
	x6 = min(x2, x4)
	y5 = max(y1, y3)
	y6 = min(y2, y4)
	ans = n * m
	(x, y) = help(1, 1, n, m)
	c1 = help(x1, y1, x2, y2)
	c2 = help(x3, y3, x4, y4)
	(x, y) = (x - c1[0] + c2[1], y + c1[0] - c2[1])
	if x6 >= x5 and y6 >= y5:
		c3 = help(x5, y5, x6, y6)
		temp = sum(c3)
		(x, y) = (x + c3[0], y - c3[0])
	print(y, x)


def intersect(x1, y1, x2, y2, x3, y3, x4, y4):
	(x, y, xi, yi) = (0, 0, 0, 0)
	if (x3 <= x2 and x4 >= x1) and (y3 <= y2 and y4 >= y1):
		(x, xi) = (max(x1, x3), min(x2, x4))
		(y, yi) = (max(y1, y3), min(y2, y4))
	return (x, y, xi, yi)

def bw(x, y, xi, yi):
	b = 0
	w = 0
	l = xi - x + 1
	h = yi - y + 1
	(b, w) = (l * h // 2, l * h // 2)
	if l * h & 1:
		if x + y & 1:
			b += 1
		else:
			w += 1
	if x == 0:
		(b, w) = (0, 0)
	return (b, w)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(x1i, y1i, x2i, y2i) = intersect(x1, y1, x2, y2, x3, y3, x4, y4)
	(b, w) = bw(1, 1, n, m)
	(bi, wi) = bw(x1i, y1i, x2i, y2i)
	(b1, w1) = bw(x1, y1, x2, y2)
	(b2, w2) = bw(x3, y3, x4, y4)
	dw = b1 - bi - w2
	db = -b1 + bi + w2
	print(w + dw, b + db)


t = int(input())

def is_black(x, y):
	return x % 2 == 0 and y % 2 == 1 or (x % 2 == 1 and y % 2 == 0)

def eval_rect(lenx, leny, lx, ly):
	if lenx % 2 == 0 or leny % 2 == 0:
		numw = lenx * leny // 2
		numb = numw
	else:
		temp = 1 if is_black(lx, ly) else 0
		numb = lenx * leny // 2 + temp
		numw = lenx * leny // 2 + (1 - temp)
	return (numw, numb)

def eval_rect_(x1, y1, x2, y2):
	lenx = x2 - x1 + 1
	leny = y2 - y1 + 1
	return eval_rect(lenx, leny, x1, y1)

def range_overlap(a_min, a_max, b_min, b_max):
	return a_min <= b_max and b_min <= a_max

def is_in_range(a, b_min, b_max):
	return a >= b_min and a <= b_max

def range_intersection(a_min, a_max, b_min, b_max):
	if is_in_range(a_min, b_min, b_max) and is_in_range(a_max, b_min, b_max):
		return (a_min, a_max)
	elif is_in_range(b_min, a_min, a_max) and is_in_range(b_max, a_min, a_max):
		return (b_min, b_max)
	elif is_in_range(a_min, b_min, b_max):
		return (a_min, b_max)
	elif is_in_range(b_min, a_min, a_max):
		return (b_min, a_max)
	else:
		return None

def intersection(x11, y11, x12, y12, x21, y21, x22, y22):
	if range_overlap(x11, x12, x21, x22) and range_overlap(y11, y12, y21, y22):
		(xl, xr) = range_intersection(x11, x12, x21, x22)
		(yb, yt) = range_intersection(y11, y12, y21, y22)
		return (xl, yb, xr, yt)
	else:
		return None
for i in range(t):
	(n, m) = [int(i) for i in input().split()]
	(wx1, wy1, wx2, wy2) = [int(i) for i in input().split()]
	(bx1, by1, bx2, by2) = [int(i) for i in input().split()]
	(wall, ball) = eval_rect_(1, 1, m, n)
	(ww, wb) = eval_rect_(wx1, wy1, wx2, wy2)
	(bw, bb) = eval_rect_(bx1, by1, bx2, by2)
	rect_intersection = intersection(wx1, wy1, wx2, wy2, bx1, by1, bx2, by2)
	if not rect_intersection:
		resultw = wall + wb - bw
		resultb = ball - wb + bw
	else:
		(dw, db) = eval_rect_(rect_intersection[0], rect_intersection[1], rect_intersection[2], rect_intersection[3])
		wb -= db
		resultw = wall + wb - bw
		resultb = ball - wb + bw
	print(resultw, resultb)


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 calculate(points, surface):
	if sum(points) % 2 != 0 and surface % 2 != 0:
		return surface // 2 + 1
	return surface // 2
result = []
n = int(input())
(_inpu, x, y) = ([], set(), set())
for _ in range(n):
	_inpu.append([*map(int, input().split()), [int(i) for i in input().split()], [int(i) for i in input().split()]])
for el in _inpu:
	surface = el[0] * el[1]
	black = surface // 2
	if surface % 2 != 0:
		white = black + 1
	else:
		white = black
	(points, black_points) = el[2:]
	surface = (points[2] - points[0] + 1) * (points[3] - points[1] + 1)
	add = calculate(points[0:2], surface)
	white += add
	black -= add
	black_x = [black_points[0], black_points[2]]
	black_y = [black_points[1], black_points[3]]
	white_x = [points[0], points[2]]
	white_y = [points[1], points[3]]
	if black_x[1] >= white_x[0] and black_x[0] <= white_x[1]:
		if black_x[1] > white_x[1]:
			x.add(white_x[1])
		else:
			x.add(black_x[1])
		if black_x[0] >= white_x[0]:
			x.add(black_x[0])
		else:
			x.add(white_x[0])
	if black_y[1] >= white_y[0] and black_y[0] <= white_y[1]:
		if black_y[1] >= white_y[1]:
			y.add(white_y[1])
		else:
			y.add(black_y[1])
		if black_y[0] >= white_y[0]:
			y.add(black_y[0])
		else:
			y.add(white_y[0])
	if x and y:
		surface = (max(x) - min(x) + 1) * (max(y) - min(y) + 1)
		add = calculate([min(x), min(y)], surface)
		black += add
		white -= add
	surface = (black_points[2] - black_points[0] + 1) * (black_points[3] - black_points[1] + 1)
	add = surface - calculate(black_points[0:2], surface)
	black += add
	white -= add
	result.append([white, black])
	x.clear()
	y.clear()
for i in result:
	print(*i, end='\n')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(a1, b1, a2, b2) = map(int, input().split())
	black = n * m // 2
	white = n * m // 2
	if n % 2 == 1 and m % 2 == 1:
		white += 1
	white += (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	black -= (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	if (x2 - x1 + 1) % 2 == 1 and (y2 - y1 + 1) % 2 == 1 and ((x1 + y1) % 2 == 1):
		white += 1
		black -= 1
	black += (a2 - a1 + 1) * (b2 - b1 + 1) // 2
	white -= (a2 - a1 + 1) * (b2 - b1 + 1) // 2
	if (a2 - a1 + 1) % 2 == 1 and (b2 - b1 + 1) % 2 == 1 and ((a1 + b1) % 2 == 0):
		black += 1
		white -= 1
	startx = max(x1, a1)
	starty = max(y1, b1)
	h = min(y2, b2) - max(b1, y1) + 1
	w = min(x2, a2) - max(a1, x1) + 1
	if w > 0 and h > 0:
		white -= h * w // 2
		black += h * w // 2
		if (startx + starty) % 2 == 1 and w % 2 == 1 and (h % 2 == 1):
			white -= 1
			black += 1
	print(white, black)


t = int(input())

def get_white(xx1, yy1, xx2, yy2):
	(h, w) = (yy2 - yy1 + 1, xx2 - xx1 + 1)
	num = h * w // 2
	if (xx1 + yy1) % 2 == 0 and h * w % 2 == 1:
		num += 1
	return num
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()))
	white = get_white(1, 1, m, n)
	white1 = get_white(x1, y1, x2, y2)
	white2 = get_white(x3, y3, x4, y4)
	(xx1, yy1) = (max(x1, x3), max(y1, y3))
	(xx2, yy2) = (min(x2, x4), min(y2, y4))
	final_white = white + ((y2 - y1 + 1) * (x2 - x1 + 1) - white1)
	tmp = final_white
	if xx1 <= xx2 and yy1 <= yy2:
		z = (xx2 - xx1 + 1) * (yy2 - yy1 + 1)
		white3 = get_white(xx1, yy1, xx2, yy2)
		final_white = final_white - z - (white2 - white3)
	else:
		final_white = final_white - white2
	print(final_white, n * m - final_white)


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()
	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
	i_w -= r2_w
	i_b += r2_w
	i_b += c_b
	i_w -= c_b
	print(i_w, i_b)


def main():
	t = int(input())
	for _ in range(t):
		test_case()

def white_inside(a, b, c, d):
	n = d - b + 1
	m = c - a + 1
	if a % 2 == 1 and b % 2 == 1 or (a % 2 == 0 and b % 2 == 0):
		return (n + 1) // 2 * ((m + 1) // 2) + n // 2 * (m // 2)
	else:
		return n // 2 * ((m + 1) // 2) + (n + 1) // 2 * (m // 2)

def black_inside(a, b, c, d):
	return cal_area(a, b, c, d) - white_inside(a, b, c, d)

def test_case():
	(n, m) = map(int, input().split())
	(a1, b1, c1, d1) = map(int, input().split())
	(a2, b2, c2, d2) = map(int, input().split())
	white = white_inside(1, 1, m, n) + black_inside(a1, b1, c1, d1) - white_inside(a2, b2, c2, d2) - black_inside(*get_incep_rec(a1, b1, c1, d1, a2, b2, c2, d2))
	black = black_inside(1, 1, m, n) - black_inside(a1, b1, c1, d1) + white_inside(a2, b2, c2, d2) + black_inside(*get_incep_rec(a1, b1, c1, d1, a2, b2, c2, d2))
	print(white, black)

def intercep(a1, c1, a2, c2):
	if a2 > c1 or c2 < a1:
		return False
	else:
		return True

def get_incep_rec(a1, b1, c1, d1, a2, b2, c2, d2):
	if intercep(a1, c1, a2, c2) and intercep(b1, d1, b2, d2):
		(a, c) = list(sorted([a1, c1, a2, c2]))[1:3]
		(b, d) = list(sorted([b1, d1, b2, d2]))[1:3]
		return (a, b, c, d)
	else:
		return (0, 0, 0, 0)

def cal_area(a, b, c, d):
	return (c - a + 1) * (d - b + 1)
main()


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()


import sys
input = sys.stdin.readline

def One(type):
	return type(input())

def List(type):
	return list(map(type, input().split()))

def Str():
	return list(input())

def Many(type):
	return map(type, input().split())

def ceil(a):
	return int(a / 2) + (1 if a % 2 == 1 else 0)

def W(a, b):
	return ceil(a) * ceil(b) + int(a / 2) * int(b / 2)

def B(a, b):
	ans = W(a, b)
	return a * b - ans

def w(x, y, a, b):
	ans = W(a, b) - W(a, y - 1) - W(x - 1, b) + W(x - 1, y - 1)
	return ans

def b(x, y, a, b):
	ans = (a - x + 1) * (b - y + 1) - w(x, y, a, b)
	return ans

def solve():
	(n, m) = Many(int)
	f = List(int)
	s = List(int)
	ansW = W(n, m)
	ansB = B(n, m)
	ansW += b(f[0], f[1], f[2], f[3])
	ansB -= b(f[0], f[1], f[2], f[3])
	ansW -= w(s[0], s[1], s[2], s[3])
	ansB += w(s[0], s[1], s[2], s[3])
	if max(f[0], s[0]) > min(f[2], s[2]) or max(f[1], s[1]) > min(f[3], s[3]):
		print(ansW, ansB)
		return
	mid = [max(f[0], s[0]), max(f[1], s[1]), min(f[2], s[2]), min(f[3], s[3])]
	ansW -= b(mid[0], mid[1], mid[2], mid[3])
	ansB += b(mid[0], mid[1], mid[2], mid[3])
	print(ansW, ansB)

def main():
	t = One(int)
	while t > 0:
		solve()
		t -= 1
main()


t = int(input())

class Rectangle:

	def __init__(self, p):
		self.left = p[0]
		self.right = p[2]
		self.bottom = p[1]
		self.top = p[3]
		self.white = 0
		self.black = 0
		self.color_count()

	def area(self):
		return (self.right - self.left + 1) * (self.top - self.bottom + 1)

	@staticmethod
	def intersection(r1, r2):
		left = max(r1.left, r2.left)
		right = min(r1.right, r2.right)
		bottom = max(r1.bottom, r2.bottom)
		top = min(r1.top, r2.top)
		return Rectangle([left, bottom, right, top])

	@staticmethod
	def do_intersect(a, b):
		if a.left > b.right or a.right < b.left:
			return False
		if a.bottom > b.top or a.top < b.bottom:
			return False
		return True

	def color_count(self):
		tot_blocks = (self.right - self.left + 1) * (self.top - self.bottom + 1)
		cnt = tot_blocks // 2
		self.black = cnt
		self.white = cnt
		if tot_blocks % 2 != 0:
			if (self.left + self.bottom) % 2 == 0:
				self.white += 1
			else:
				self.black += 1
while t > 0:
	(n, m) = [int(i) for i in input().split()]
	p1 = [int(i) for i in input().split()]
	p2 = [int(i) for i in input().split()]
	r0 = Rectangle([1, 1, n, m])
	r1 = Rectangle(p1)
	r2 = Rectangle(p2)
	if Rectangle.do_intersect(r1, r2) == False:
		print(r0.white - r2.white + r1.black, r0.black - r1.black + r2.white)
	else:
		ir = Rectangle.intersection(r1, r2)
		print(r0.white - r2.white + r1.black - ir.black, r0.black - r1.black + r2.white + ir.black)
	t -= 1


from math import ceil
from sys import stdin

class Rectangle:

	def __init__(self, x1, y1, x2, y2):
		self.x1 = x1
		self.y1 = y1
		self.x2 = x2
		self.y2 = y2

	def size(self):
		if self.y1 > self.y2 or self.x1 > self.x2:
			return 0
		return (self.x2 - self.x1 + 1) * (self.y2 - self.y1 + 1)

	def intersect(self, r):
		return Rectangle(max(self.x1, r.x1), max(self.y1, r.y1), min(self.x2, r.x2), min(self.y2, r.y2))

	def white(self):
		return self.size() - self.black()

	def black(self):
		if self.y1 > self.y2 or self.x1 > self.x2:
			return 0
		if (self.y2 - self.y1 + 1) % 2 == 0:
			return self.size() // 2
		res = (self.y2 - self.y1) * (self.x2 - self.x1 + 1) // 2
		if (self.x1 + self.y1) % 2 == 0:
			res += (self.x2 - self.x1 + 1) // 2
		else:
			res += ceil((self.x2 - self.x1 + 1) / 2)
		return res

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(n, m) = map(int, stdin.readline().split(' '))
		(x1, y1, x2, y2) = map(int, stdin.readline().split(' '))
		(x3, y3, x4, y4) = map(int, stdin.readline().split(' '))
		A = Rectangle(x1, y1, x2, y2)
		B = Rectangle(x3, y3, x4, y4)
		C = A.intersect(B)
		board = Rectangle(1, 1, m, n)
		black = board.black() - A.black() + C.black() + B.white()
		print(str(board.size() - black) + ' ' + str(black))
main()


import math

def w(a, b):
	return math.ceil(a / 2) * math.ceil(b / 2) + math.floor(a / 2) * math.floor(b / 2)

def W(x1, y1, x2, y2):
	return w(x2, y2) - w(x2, y1 - 1) - w(x1 - 1, y2) + w(x1 - 1, y1 - 1)

def B(x1, y1, x2, y2):
	return (y2 - y1 + 1) * (x2 - x1 + 1) - W(x1, y1, x2, y2)
t = int(input())
while t > 0:
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	white = W(1, 1, m, n)
	black = B(1, 1, m, n)
	white += B(x1, y1, x2, y2)
	black -= B(x1, y1, x2, y2)
	white -= W(x3, y3, x4, y4)
	black += W(x3, y3, x4, y4)
	if max(x1, x3) <= min(x2, x4) and max(y1, y3) <= min(y2, y4):
		white -= B(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
		black += B(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	print(white, black)
	t -= 1


def check(l1, r1, l2, r2):
	ax = max(0, r2 - r1 + 1)
	ay = max(0, l2 - l1 + 1)
	b = w = ax * ay // 2
	if ax % 2 != 0 and ay % 2 != 0:
		if (l1 + r1) % 2 == 0:
			w += 1
		else:
			b += 1
	return [b, w]
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(x5, y5, x6, y6) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	(b, w) = check(1, 1, m, n)
	(aa, bb) = check(x1, y1, x2, y2)
	b -= aa
	w += aa
	(aa, bb) = check(x5, y5, x6, y6)
	(aaa, bbb) = check(x3, y3, x4, y4)
	w -= bbb + aa
	b += bbb + aa
	print(w, b)


def w(x1, y1, x2, y2):
	if (x2 - x1 + 1) * (y2 - y1 + 1) % 2 == 0:
		return (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	elif (x1 + y1) % 2 == 0:
		return (x2 - x1 + 1) * (y2 - y1 + 1) // 2 + 1
	else:
		return (x2 - x1 + 1) * (y2 - y1 + 1) // 2

def bl(x1, y1, x2, y2):
	if (x2 - x1 + 1) * (y2 - y1 + 1) % 2 == 0:
		return (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	elif (x1 + y1) % 2 == 0:
		return (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	else:
		return (x2 - x1 + 1) * (y2 - y1 + 1) // 2 + 1
t = int(input())
for _ in ' ' * t:
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(a, b, c, d) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	if a > c or b > d:
		black = bl(1, 1, m, n) - bl(x1, y1, x2, y2) + w(x3, y3, x4, y4)
	else:
		black = bl(1, 1, m, n) - bl(x1, y1, x2, y2) + w(x3, y3, x4, y4) + bl(a, b, c, d)
	print(n * m - black, black)


def count_in_grid(a, b, c, d, white):
	pole = a % 2 == b % 2
	value = (c - a + 1) * (d - b + 1)
	if value % 2 == 0:
		white_count = value // 2
	elif pole:
		white_count = value // 2 + 1
	else:
		white_count = value // 2
	if white:
		return white_count
	else:
		return value - white_count

def func(x1, y1, x2, y2, x3, y3, x4, y4, white):
	store = white
	if (x2 < x3 or x4 < x1) or (y2 < y3 or y4 < y1):
		store += count_in_grid(x1, y1, x2, y2, False)
		store -= count_in_grid(x3, y3, x4, y4, True)
	else:
		store += count_in_grid(x1, y1, x2, y2, False)
		store -= count_in_grid(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4), False)
		store -= count_in_grid(x3, y3, x4, y4, True)
	return store

def main():
	count = int(input())
	for x in range(count):
		arr = input().split(' ')
		area = int(arr[0]) * int(arr[1])
		if area % 2 == 0:
			white = area // 2
		else:
			white = area // 2 + 1
		store = []
		arr = input().split(' ')
		for x in arr:
			store.append(int(x))
		arr = input().split(' ')
		for x in arr:
			store.append(int(x))
		white = func(store[0], store[1], store[2], store[3], store[4], store[5], store[6], store[7], white)
		print(white, area - white)
main()


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
	(wc, bc) = count(x1, y1, x2, y2)
	w -= wc
	b -= bc
	w += (x2 - x1 + 1) * (y2 - y1 + 1)
	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)


t = int(input())
result = []

def GetCellWhiteAndBlackCount(x1, y1, x2, y2):
	if (x1 + y1) % 2 == 0:
		startWithWhite = True
	else:
		startWithWhite = False
	n = y2 - y1 + 1
	m = x2 - x1 + 1
	if n * m % 2 == 0:
		b = n * m // 2
		w = n * m // 2
	else:
		b = n * m // 2
		w = n * m // 2 + 1
	if startWithWhite == False:
		[b, w] = [w, b]
	return [w, b]

def GetOverlapArea(area1, area2):
	[x1, y1, x2, y2] = area1
	[x3, y3, x4, y4] = area2
	maxminX = max(x1, x3)
	minmaxX = min(x2, x4)
	maxminY = max(y1, y3)
	minmaxY = min(y2, y4)
	divx = minmaxX - maxminX
	divy = minmaxY - maxminY
	if divx >= 0 and divy >= 0:
		return [maxminX, maxminY, minmaxX, minmaxY]

def GetAreaSize(x1, y1, x2, y2):
	n = y2 - y1 + 1
	m = x2 - x1 + 1
	return n * m
for _ in range(t):
	[n, m] = [int(x) for x in input().split(' ')]
	[w, b] = GetCellWhiteAndBlackCount(1, 1, m, n)
	[x1, y1, x2, y2] = [int(x) for x in input().split(' ')]
	[areaW, areaB] = GetCellWhiteAndBlackCount(x1, y1, x2, y2)
	[w, b] = [w - areaW + GetAreaSize(x1, y1, x2, y2), b - areaB]
	[x3, y3, x4, y4] = [int(x) for x in input().split(' ')]
	[areaW, areaB] = GetCellWhiteAndBlackCount(x3, y3, x4, y4)
	overlapArea = GetOverlapArea([x1, y1, x2, y2], [x3, y3, x4, y4])
	[OverlapAreaW, OverlapAreaB] = [0, 0]
	if overlapArea is not None:
		[x5, y5, x6, y6] = overlapArea
		[OverlapAreaW, OverlapAreaB] = GetCellWhiteAndBlackCount(x5, y5, x6, y6)
	[w, b] = [w - areaW - OverlapAreaB, b - areaB + GetAreaSize(x3, y3, x4, y4) + OverlapAreaB]
	result.append([w, b])
for arr in result:
	print(str(arr[0]) + ' ' + str(arr[1]))


def ww(x, y):
	return (x * y + 1) // 2

def bb(x, y):
	return x * y - ww(x, y)

def w(x1, y1, x2, y2):
	return ww(x2, y2) - ww(x1 - 1, y2) - ww(x2, y1 - 1) + ww(x1 - 1, y1 - 1)

def b(x1, y1, x2, y2):
	return (x2 - x1 + 1) * (y2 - y1 + 1) - w(x1, y1, x2, y2)
for _ in range(int(input().strip())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(nw, nb) = (ww(m, n), bb(m, n))
	x = b(x1, y1, x2, y2)
	nw += x
	nb -= x
	y = w(x3, y3, x4, y4)
	nw -= y
	nb += y
	if not (x3 > x2 or x4 < x1 or y4 < y1 or (y2 < y3)):
		(X1, Y1) = (max(x1, x3), max(y1, y3))
		(X2, Y2) = (min(x2, x4), min(y2, y4))
		c = b(X1, Y1, X2, Y2)
		nw -= c
		nb += c
	print(nw, nb)


import io, os, sys
try:
	fin = open('in')
	input = fin.readline
except:
	input = sys.stdin.readline

def cnt(a, b, c, d, r):
	if a > c or b > d:
		return 0
	s = (c - a + 1) * (d - b + 1) // 2
	if a % 2 == c % 2 and b % 2 == d % 2 and ((a + b + r) % 2 == 0):
		s += 1
	return s
for _ in range(int(input())):
	(y, x) = map(int, input().split())
	(a, b, c, d) = list(map(int, input().split()))
	(e, f, g, h) = list(map(int, input().split()))
	W = cnt(1, 1, x, y, 0) + cnt(a, b, c, d, 1) - cnt(e, f, g, h, 0) - cnt(max(a, e), max(b, f), min(c, g), min(d, h), 1)
	print(W, x * y - W)


from math import ceil, floor

def w(a, b, c, d):
	if a == 1 and b == 1:
		return ceil((c - a + 1) / 2) * ceil((d - b + 1) / 2) + floor((c - a + 1) / 2) * floor((d - b + 1) / 2)
	if a < 1 or c < 1:
		return 0
	return w(1, 1, c, d) - w(1, 1, a - 1, d) - w(1, 1, c, b - 1) + w(1, 1, a - 1, b - 1)

def blackkk(a, b, c, d):
	return (c - a + 1) * (d - b + 1) - w(a, b, c, d)
for _ in range(int(input())):
	(n, m) = [int(i) for i in input().split()]
	(a, b, c, d) = [int(i) for i in input().split()]
	(p, q, r, s) = [int(i) for i in input().split()]
	white = w(1, 1, n, m)
	black = blackkk(1, 1, n, m)
	bl = blackkk(a, b, c, d)
	white += bl
	black -= bl
	justx = [a, c, p, r]
	justy = [b, d, q, s]
	justx.sort()
	justy.sort()
	if (c < p or r < a) or (d < q or s < b):
		some = 0
	else:
		some = blackkk(justx[1], justy[1], justx[2], justy[2])
	wh = w(p, q, r, s) + some
	white -= wh
	black += wh
	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, 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())


t = int(input())
for test 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())
	tot = n * m
	if tot % 2 == 0:
		b = tot // 2
		w = tot // 2
	else:
		b = tot // 2
		w = (tot + 1) // 2
	tot = (x2 - x1 + 1) * (y2 - y1 + 1)
	if (x1 + y1) % 2 == 0:
		tmp = tot // 2
		b -= tmp
		w += tmp
	elif tot % 2 == 0:
		tmp = tot // 2
		b -= tmp
		w += tmp
	else:
		tmp = (tot + 1) // 2
		b -= tmp
		w += tmp
	tot = (x4 - x3 + 1) * (y4 - y3 + 1)
	if (x3 + y3) % 2 == 1:
		tmp = tot // 2
		b += tmp
		w -= tmp
	elif tot % 2 == 0:
		tmp = tot // 2
		b += tmp
		w -= tmp
	else:
		tmp = (tot + 1) // 2
		b += tmp
		w -= tmp
	if not (x1 > x4 or x3 > x2 or y1 > y4 or (y3 > y2)):
		x1 = max(x1, x3)
		y1 = max(y1, y3)
		x2 = min(x2, x4)
		y2 = min(y2, y4)
		tot = (x2 - x1 + 1) * (y2 - y1 + 1)
		if (x1 + y1) % 2 == 0:
			tmp = tot // 2
			b += tmp
			w -= tmp
		elif tot % 2 == 0:
			tmp = tot // 2
			b += tmp
			w -= tmp
		else:
			tmp = (tot + 1) // 2
			b += tmp
			w -= tmp
	print(w, b)


def call(x, y):
	if x >= 1 and y >= 1:
		w = (x + 1) // 2
		b = x - w
		if w == b:
			w *= y
			b *= y
		else:
			w -= 1
			w *= y
			b *= y
			w += (y + 1) // 2
			b += y // 2
		return (w, b)
	else:
		return (0, 0)

def repo(x, y, x1, y1):
	(w, b) = call(x1, y1)
	(w1, b1) = call(x - 1, y - 1)
	(w2, b2) = call(x1, y - 1)
	(w3, b3) = call(x - 1, y1)
	w = w - w2 - w3 + w1
	b = b - b2 - b3 + b1
	return (w, b)

def fun(x, y, x1, y1, X, Y, X1, Y1):
	if X <= x <= X1:
		xx = x
	if X <= x1 <= X1:
		xx2 = x1
	if x <= X <= x1:
		xx = X
	if x <= X1 <= x1:
		xx2 = X1
	if Y <= y <= Y1:
		yy = y
	if Y <= y1 <= Y1:
		yy2 = y1
	if y <= Y <= y1:
		yy = Y
	if y <= Y1 <= y1:
		yy2 = Y1
	return repo(xx, yy, xx2, yy2)
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	(x, y, x1, y1) = map(int, input().split())
	(X, Y, X1, Y1) = map(int, input().split())
	(w, b) = call(m, n)
	(w1, b1) = repo(x, y, x1, y1)
	(w2, b2) = repo(X, Y, X1, Y1)
	if X1 < x or x1 < X or Y1 < y or (y1 < Y):
		w3 = 0
		b3 = 0
	else:
		(w3, b3) = fun(x, y, x1, y1, X, Y, X1, Y1)
	print(w + b1 - w2 - b3, b - b1 + w2 + b3)


def check(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 (b, w)

def chec(l1, r1, l2, r2):
	b = w = 0
	aaa = (r2 - r1 + 1) * (l2 - l1 + 1) // 2
	if (l2 - l1 + 1) % 2 != 0 and (r2 - r1 + 1) % 2 != 0:
		if (l1 + r1) % 2 == 0:
			w = aaa + 1
			b = aaa
		else:
			b = aaa + 1
			w = aaa
	else:
		b = w = aaa
	return [max(b, 0), max(w, 0)]
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(x5, y5, x6, y6) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	(b, w) = check(1, 1, n, m)
	(b1, w1) = check(x1, y1, x2, y2)
	(b3, w3) = check(x5, y5, x6, y6)
	(b2, w2) = check(x3, y3, x4, y4)
	b += w2 + b3 - b1
	w += b1 - w2 - b3
	print(w, b)


t = int(input())

def _w(x1, y1, x2, y2):
	if x1 % 2 == y1 % 2:
		return (y2 - y1 + 2) // 2 * (x2 - x1 + 1) - (y2 - y1 + 1) % 2 * (x2 - x1 + 1) // 2
	else:
		return (y2 - y1 + 2) // 2 * (x2 - x1 + 1) - (y2 - y1 + 1) % 2 * (x2 - x1 + 2) // 2

def _b(x1, y1, x2, y2):
	return (y2 - y1 + 1) * (x2 - x1 + 1) - _w(x1, y1, x2, y2)
while t > 0:
	(h, w) = map(int, input().split())
	black = h // 2 * w + h % 2 * w // 2
	white = (h + 1) // 2 * w - h % 2 * w // 2
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	white += _b(x1, y1, x2, y2)
	black -= _b(x1, y1, x2, y2)
	white -= _w(x3, y3, x4, y4)
	black += _w(x3, y3, x4, y4)
	(ax, ay, bx, by) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	if ax <= bx and ay <= by:
		a = bx - ax + 1
		b = by - ay + 1
		white -= _b(ax, ay, bx, by)
		black += _b(ax, ay, bx, by)
	print(white, black)
	t -= 1


t = int(input())

def count(x1, y1, x2, y2):
	n = y2 - y1 + 1
	m = x2 - x1 + 1
	W = (n + 1) // 2 * ((m + 1) // 2) + (n - (n + 1) // 2) * (m - (m + 1) // 2)
	B = (n + 1) // 2 * (m // 2) + (n - (n + 1) // 2) * (m - m // 2)
	if (x1 + y1) % 2 == 1:
		(W, B) = (B, W)
	return (W, B)
for _ in range(t):
	(n, m) = map(int, input().split())
	W = (n + 1) // 2 * ((m + 1) // 2) + (n - (n + 1) // 2) * (m - (m + 1) // 2)
	B = (n + 1) // 2 * (m // 2) + (n - (n + 1) // 2) * (m - m // 2)
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	if x2 < x3:
		(w1, b1) = count(x1, y1, x2, y2)
		W += -w1 + w1 + b1
		B -= b1
		(w2, b2) = count(x3, y3, x4, y4)
		W -= w2
		B += w2 + b2 - b2
	elif x3 <= x2 <= x4:
		if x1 < x3:
			if y2 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y2 <= y4:
				if y1 < y3:
					(w1, b1) = count(x1, y1, x2, y2)
					(w1_, b1_) = count(x3, y3, x2, y2)
					w1 -= w1_
					b1 -= b1_
					W += -w1 + w1 + b1
					B -= b1
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
				elif y3 <= y1 <= y4:
					(w1, b1) = count(x1, y1, x2, y2)
					(w1_, b1_) = count(x3, y1, x2, y2)
					w1 -= w1_
					b1 -= b1_
					W += -w1 + w1 + b1
					B -= b1
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
			elif y1 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x3, y3, x2, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y1 <= y4:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x3, y1, x2, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			else:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
		elif x3 <= x1 <= x4:
			if y2 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y2 <= y4:
				if y1 < y3:
					(w1, b1) = count(x1, y1, x2, y2)
					(w1_, b1_) = count(x1, y3, x2, y2)
					w1 -= w1_
					b1 -= b1_
					W += -w1 + w1 + b1
					B -= b1
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
				elif y3 <= y1 <= y4:
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
			elif y1 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x1, y3, x2, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y1 <= y4:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x1, y1, x2, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			else:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
	elif x4 < x2:
		if x1 < x3:
			if y2 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y2 <= y4:
				if y1 < y3:
					(w1, b1) = count(x1, y1, x2, y2)
					(w1_, b1_) = count(x3, y3, x4, y2)
					w1 -= w1_
					b1 -= b1_
					W += -w1 + w1 + b1
					B -= b1
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
				elif y3 <= y1 <= y4:
					(w1, b1) = count(x1, y1, x2, y2)
					(w1_, b1_) = count(x3, y1, x4, y2)
					w1 -= w1_
					b1 -= b1_
					W += -w1 + w1 + b1
					B -= b1
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
			elif y1 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x3, y3, x4, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y1 <= y4:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x3, y1, x4, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			else:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
		elif x3 <= x1 <= x4:
			if y2 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y2 <= y4:
				if y1 < y3:
					(w1, b1) = count(x1, y1, x2, y2)
					(w1_, b1_) = count(x1, y3, x4, y2)
					w1 -= w1_
					b1 -= b1_
					W += -w1 + w1 + b1
					B -= b1
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
				elif y3 <= y1 <= y4:
					(w1, b1) = count(x1, y1, x2, y2)
					(w1_, b1_) = count(x1, y1, x4, y2)
					w1 -= w1_
					b1 -= b1_
					W += -w1 + w1 + b1
					B -= b1
					(w2, b2) = count(x3, y3, x4, y4)
					W -= w2
					B += w2 + b2 - b2
			elif y1 < y3:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x1, y3, x4, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			elif y3 <= y1 <= y4:
				(w1, b1) = count(x1, y1, x2, y2)
				(w1_, b1_) = count(x1, y1, x4, y4)
				w1 -= w1_
				b1 -= b1_
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
			else:
				(w1, b1) = count(x1, y1, x2, y2)
				W += -w1 + w1 + b1
				B -= b1
				(w2, b2) = count(x3, y3, x4, y4)
				W -= w2
				B += w2 + b2 - b2
		else:
			(w1, b1) = count(x1, y1, x2, y2)
			W += -w1 + w1 + b1
			B -= b1
			(w2, b2) = count(x3, y3, x4, y4)
			W -= w2
			B += w2 + b2 - b2
	print(W, B)


def f(l, flag=True):
	(n, m) = l
	res = [m * (n // 2)] * 2
	if n & 1:
		res[0] += (m + 1) // 2
		res[1] += m // 2
	return res if flag else res[::-1]

def check(l):
	(a, b) = l
	return not bool(a & 1 ^ b & 1)

def lxy(r):
	return [r[2] - r[0] + 1, r[3] - r[1] + 1]

def area(r):
	xy = lxy(r)
	return xy[0] * xy[1]

def valid(r1, r2):
	if r1[0] <= r2[0] <= r1[2]:
		if r1[1] <= r2[1] <= r1[3] or r1[1] <= r2[3] <= r1[3]:
			return True
		if r2[1] <= r1[1] <= r2[3] or r2[1] <= r1[3] <= r2[3]:
			return True
	if r1[0] <= r2[2] <= r1[2]:
		if r1[1] <= r2[1] <= r1[3] or r1[1] <= r2[3] <= r1[3]:
			return True
		if r2[1] <= r1[1] <= r2[3] or r2[1] <= r1[3] <= r2[3]:
			return True
	return False
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	r1 = [*map(int, input().split())]
	r2 = [*map(int, input().split())]
	res = f([n, m])
	res[0] += area(r1)
	res[1] += area(r2)
	l = f(lxy(r1), check(r1[:2]))
	res = [res[i] - l[i] for i in range(2)]
	l = f(lxy(r2), check(r2[:2]))
	res = [res[i] - l[i] for i in range(2)]
	if valid(r1, r2) or valid(r2, r1):
		r3 = [max(r1[0], r2[0]), max(r1[1], r2[1]), min(r1[2], r2[2]), min(r1[3], r2[3])]
		res[0] -= area(r3)
		l = f(lxy(r3), check(r3[:2]))
		res = [res[i] + l[i] for i in range(2)]
	print(res[0], res[1])


def check(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 (b, w)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(x5, y5, x6, y6) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	(b, w) = check(1, 1, n, m)
	(aa, bb) = check(x1, y1, x2, y2)
	b -= aa
	w += aa
	(aa, bb) = check(x5, y5, x6, y6)
	(aaa, bbb) = check(x3, y3, x4, y4)
	w -= bbb + aa
	b += bbb + aa
	print(w, b)


def absc(x):
	return abs(x) + 1

def ck(x1, y1, x2, y2):
	if absc(x1 - x2) * absc(y2 - y1) % 2 == 0:
		return (absc(x1 - x2) * absc(y2 - y1) // 2, absc(x1 - x2) * absc(y2 - y1) // 2)
	elif (x1 + y1) % 2 == 0:
		return (absc(x1 - x2) * absc(y2 - y1) // 2 + 1, absc(x1 - x2) * absc(y2 - y1) // 2)
	else:
		return (absc(x1 - x2) * absc(y2 - y1) // 2, absc(x1 - x2) * absc(y2 - y1) // 2 + 1)
t = int(input())
ans = []
for i 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()))
	(white, black) = ck(1, 1, n, m)
	b1 = ck(x1, y1, x2, y2)[1]
	white += b1
	black -= b1
	w1 = ck(x3, y3, x4, y4)[0]
	rect = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	if rect[0] <= rect[2] and rect[1] <= rect[3]:
		white -= absc(rect[2] - rect[0]) * absc(rect[3] - rect[1])
		wm = ck(*rect)
		white -= w1 - wm[0]
		black += w1 + absc(rect[2] - rect[0]) * absc(rect[3] - rect[1]) - wm[0]
	else:
		white -= w1
		black += w1
	ans.append((white, black))
for i in ans:
	print(*i)


import sys
input = sys.stdin.readline
testcase = int(input())
T = [list(map(int, input().split())) for i in range(testcase * 3)]

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
	WHITE2 = COMMON(WHITE, BLACK)
	k = BtoW(WHITE)
	ANSB -= k
	ANSW += k
	if WHITE2[0] > WHITE2[2] or WHITE2[1] > WHITE2[3]:
		True
	else:
		l = BtoW(WHITE2)
		ANSB += l
		ANSW -= l
	m = WtoB(BLACK)
	ANSB += m
	ANSW -= m
	print(ANSW, ANSB)


from collections import namedtuple
Rectangle = namedtuple('Rectangle', 'xmin ymin xmax ymax')

def area(a, b):
	dx = min(a.xmax, b.xmax) - max(a.xmin, b.xmin)
	dy = min(a.ymax, b.ymax) - max(a.ymin, b.ymin)
	if dx >= 0 and dy >= 0:
		return (dx + 1) * (dy + 1)
	return 0
for i in range(int(input())):
	(n, m) = map(int, input().split())
	(a, b, c, d) = map(int, input().split())
	(w, x, y, z) = map(int, input().split())
	wh = m * n // 2 + m * n % 2
	bl = m * n // 2
	ra = Rectangle(a, b, c, d)
	rb = Rectangle(w, x, y, z)
	if (a + b) % 2 == 0:
		bl -= (abs(a - c) + 1) * (abs(b - d) + 1) // 2
		wh += (abs(a - c) + 1) * (abs(b - d) + 1) // 2
	else:
		bl -= (abs(a - c) + 1) * (abs(b - d) + 1) // 2 + (abs(a - c) + 1) * (abs(b - d) + 1) % 2
		wh += (abs(a - c) + 1) * (abs(b - d) + 1) // 2 + (abs(a - c) + 1) * (abs(b - d) + 1) % 2
	if (w + x) % 2 == 1:
		wh -= (abs(w - y) + 1) * (abs(x - z) + 1) // 2
		bl += (abs(w - y) + 1) * (abs(x - z) + 1) // 2
	else:
		wh -= (abs(w - y) + 1) * (abs(x - z) + 1) // 2 + (abs(w - y) + 1) * (abs(x - z) + 1) % 2
		bl += (abs(w - y) + 1) * (abs(x - z) + 1) // 2 + (abs(w - y) + 1) * (abs(x - z) + 1) % 2
	r = max(ra.xmin, rb.xmin)
	s = max(ra.ymin, rb.ymin)
	wh -= area(ra, rb)
	if (r + s) % 2 == 0:
		wh += area(ra, rb) // 2 + area(ra, rb) % 2
		bl += area(ra, rb) // 2
	else:
		wh += area(ra, rb) // 2
		bl += area(ra, rb) // 2 + area(ra, rb) % 2
	print(wh, bl)


def mainA():
	(n, k) = map(int, input().split())
	a = (2 * n, 5 * n, 8 * n)
	print(sum(map(lambda x: (x + k - 1) // k, a)))

def mainB():

	def calc(x):
		return -x + x // 2 if x & 1 else x // 2
	T = int(input())
	for t in range(T):
		(l, r) = map(int, input().split())
		print(calc(r) - calc(l - 1))

def mainC():

	def count(x1, y1, x2, y2):
		if x1 > x2 or y1 > y2:
			return 0
		ret = (x2 - x1 + 1) * (y2 - y1 + 1) // 2
		return ret if x2 - x1 & 1 or y2 - y1 & 1 or (not x1 + y1 & 1) else ret + 1
	T = int(input())
	for t 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, y5, x6, y6) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
		black = count(1, 1, n, m) - count(x1, y1, x2, y2) - count(x3, y3, x4, y4) + count(x5, y5, x6, y6) + (y4 - y3 + 1) * (x4 - x3 + 1)
		print(n * m - black, black)
mainC()


def white(x1, y1, x2, y2):
	h = y2 - y1 + 1
	w = x2 - x1 + 1
	if h % 2 == 0:
		return int(h / 2) * w
	elif w % 2 == 0:
		return int(w / 2) * h
	elif (x1 + y1) % 2 == 0:
		return w * int((h + 1) / 2) - int((w - 1) / 2)
	else:
		return w * int((h + 1) / 2) - int((w + 1) / 2)

def black(x1, y1, x2, y2):
	h = y2 - y1 + 1
	w = x2 - x1 + 1
	if h % 2 == 0:
		return int(h / 2) * w
	elif w % 2 == 0:
		return int(w / 2) * h
	elif (x1 + y1) % 2 == 0:
		return w * int((h + 1) / 2) - int((w + 1) / 2)
	else:
		return w * int((h + 1) / 2) - int((w - 1) / 2)
t = int(input())
for i in range(0, t):
	(n, m) = [int(x) for x in input().split()]
	(x1, y1, x2, y2) = [int(x) for x in input().split()]
	(x3, y3, x4, y4) = [int(x) for x in input().split()]
	if y2 < y3 or y4 < y1 or x2 < x3 or (x4 < x1):
		W = white(1, 1, m, n) + black(x1, y1, x2, y2) - white(x3, y3, x4, y4)
		B = black(1, 1, m, n) - black(x1, y1, x2, y2) + white(x3, y3, x4, y4)
		print(int(W), int(B))
	else:
		X = [x1, x2, x3, x4]
		Y = [y1, y2, y3, y4]
		X.sort()
		Y.sort()
		w = white(1, 1, m, n)
		b = black(1, 1, m, n)
		b1 = black(x1, y1, x2, y2)
		w1 = white(x3, y3, x4, y4)
		b2 = black(X[1], Y[1], X[2], Y[2])
		print(int(w + b1 - w1 - b2), int(b - b1 + w1 + b2))


def count(xs, ys, xg, yg):
	if (xs + ys) % 2 == 0:
		b = (xg - xs + 1) * (yg - ys + 1) // 2
		w = (xg - xs + 1) * (yg - ys + 1) - b
	else:
		w = (xg - xs + 1) * (yg - ys + 1) // 2
		b = (xg - xs + 1) * (yg - ys + 1) - w
	return (w, b)
t = int(input())
for _ 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())
	(w1, b1) = count(1, 1, m, n)
	(w2, b2) = count(x1, y1, x2, y2)
	(w3, b3) = count(x3, y3, x4, y4)
	(x5, y5) = (max(x1, x3), max(y1, y3))
	(x6, y6) = (min(x2, x4), min(y2, y4))
	if x5 <= x6 and y5 <= y6:
		(w4, b4) = count(x5, y5, x6, y6)
		w = w1 - w2 - w3 + w4 + (x2 - x1 + 1) * (y2 - y1 + 1) - (x6 - x5 + 1) * (y6 - y5 + 1)
		b = b1 - b2 - b3 + b4 + (x4 - x3 + 1) * (y4 - y3 + 1)
	else:
		w = w1 - w2 - w3 + (x2 - x1 + 1) * (y2 - y1 + 1)
		b = b1 - b2 - b3 + (x4 - x3 + 1) * (y4 - y3 + 1)
	print(w, b)


import sys

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

def cnt_b(xx1, yy1, xx2, yy2):
	w = xx2 - xx1 + 1
	h = yy2 - yy1 + 1
	return w * h - cnt_w(xx1, yy1, xx2, yy2)

def cnt_w(xx1, yy1, xx2, yy2):
	w = xx2 - xx1 + 1
	h = yy2 - yy1 + 1
	cnt = w * h // 2
	if w % 2 and h % 2:
		if xx1 % 2 and yy1 % 2 or (xx1 % 2 == 0 and yy1 % 2 == 0):
			cnt += 1
	return cnt

def area(w, h):
	return w * h

def cross_rect(x1, y1, x2, y2, x3, y3, x4, y4):
	xl = max(x1, x3)
	xr = min(x2, x4)
	yl = max(y1, y3)
	yr = min(y2, y4)
	if xl <= xr and yl <= yr:
		return (xl, yl, xr, yr)
	else:
		return (-1, -1, -1, -1)
t = int(input())
for i in range(t):
	(n, m) = rint()
	(x1, y1, x2, y2) = rint()
	(x3, y3, x4, y4) = rint()
	tot_w = cnt_w(1, 1, m, n)
	wc = tot_w + cnt_b(x1, y1, x2, y2)
	wc -= cnt_w(x3, y3, x4, y4)
	(xl, yl, xr, yr) = cross_rect(x1, y1, x2, y2, x3, y3, x4, y4)
	if xl != -1:
		wc -= cnt_b(xl, yl, xr, yr)
	print(wc, m * n - wc)


import math

def sol(n, m):
	w = 0
	w += math.ceil(n / 2) * math.ceil(m / 2)
	w += math.floor(n / 2) * math.floor(m / 2)
	return w
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	w = sol(n, m)
	if (x1 + y1) % 2 == 0:
		w += (y2 - y1 + 1) * (x2 - x1 + 1) - sol(y2 - y1 + 1, x2 - x1 + 1)
	else:
		w += sol(y2 - y1 + 1, x2 - x1 + 1)
	if (x3 + y3) % 2 == 1:
		w -= (y4 - y3 + 1) * (x4 - x3 + 1) - sol(y4 - y3 + 1, x4 - x3 + 1)
	else:
		w -= sol(y4 - y3 + 1, x4 - x3 + 1)
	if x4 < x1 or x3 > x2 or y4 < y1 or (y3 > y2):
		print(w, n * m - w)
	else:
		l1 = max(x1, x3)
		l2 = max(y1, y3)
		l3 = min(x2, x4)
		l4 = min(y4, y2)
		if (l1 + l2) % 2 == 0:
			w -= (l4 - l2 + 1) * (l3 - l1 + 1) - sol(l4 - l2 + 1, l3 - l1 + 1)
		else:
			w -= sol(l4 - l2 + 1, l3 - l1 + 1)
		print(w, n * m - w)


t = int(input())
(a, b) = ([0, 0, 0, 0], [0, 0, 0, 0])
(h, w) = (0, 0)
(black, white) = (0, 0)
(black1, black2, black3, white1, white2, white3) = (0, 0, 0, 0, 0, 0)
(overlapx, overlapy) = (0, 0)
for i in range(t):
	(h, w) = input().split()
	(h, w) = (int(h), int(w))
	black = h * w // 2
	white = h * w - black
	(black3, white3) = (0, 0)
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if (a[0] + a[1]) % 2 == 0:
		white1 = (a[2] - a[0] + 1) * (a[3] - a[1] + 1) // 2 + (a[2] - a[0] + 1) * (a[3] - a[1] + 1) % 2
		black1 = (a[2] - a[0] + 1) * (a[3] - a[1] + 1) // 2
	else:
		black1 = (a[2] - a[0] + 1) * (a[3] - a[1] + 1) // 2 + (a[2] - a[0] + 1) * (a[3] - a[1] + 1) % 2
		white1 = (a[2] - a[0] + 1) * (a[3] - a[1] + 1) // 2
	if (b[0] + b[1]) % 2 == 0:
		white2 = (b[2] - b[0] + 1) * (b[3] - b[1] + 1) // 2 + (b[2] - b[0] + 1) * (b[3] - b[1] + 1) % 2
		black2 = (b[2] - b[0] + 1) * (b[3] - b[1] + 1) // 2
	else:
		black2 = (b[2] - b[0] + 1) * (b[3] - b[1] + 1) // 2 + (b[2] - b[0] + 1) * (b[3] - b[1] + 1) % 2
		white2 = (b[2] - b[0] + 1) * (b[3] - b[1] + 1) // 2
	overlapx = min(a[2], b[2]) - max(a[0], b[0]) + 1
	overlapy = min(a[3], b[3]) - max(a[1], b[1]) + 1
	if overlapx > 0 and overlapy > 0:
		if (max(a[0], b[0]) + max(a[1], b[1])) % 2 == 0:
			white3 = overlapx * overlapy // 2 + overlapx * overlapy % 2
			black3 = overlapx * overlapy // 2
		else:
			black3 = overlapx * overlapy // 2 + overlapx * overlapy % 2
			white3 = overlapx * overlapy // 2
	white += black1
	black -= black1
	black += white2
	white -= white2
	black += black3
	white -= black3
	print(str(white) + ' ' + str(black))


n = int(input())
(x1, y1, x2, y2) = (0, 1, 2, 3)
for _ in range(n):
	(N, M) = (int(v) for v in input().split())
	w = [int(v) for v in input().split()]
	b = [int(v) for v in input().split()]
	black = N * M // 2
	white = N * M - black

	def cnt(c, k):
		area = (c[x2] - c[x1] + 1) * (c[y2] - c[y1] + 1)
		cc = area // 2
		if area % 2 == 1 and (c[x1] + c[y1]) % 2 == k:
			cc += 1
		return cc
	wc = cnt(w, 1)
	black -= wc
	white += wc
	bc = cnt(b, 0)
	black += bc
	white -= bc
	ol = [max(w[x1], b[x1]), max(w[y1], b[y1]), min(w[x2], b[x2]), min(w[y2], b[y2])]
	if ol[x1] <= ol[x2] and ol[y1] <= ol[y2]:
		oc = cnt(ol, 1)
		black += oc
		white -= oc
	print(white, black)


from math import ceil

def w(a, b):
	ans = b // 2 * (a // 2) + ceil(a / 2) * ceil(b / 2)
	return ans

def W(a, b, c, d):
	ans = 0
	ans += w(c, d) - w(a - 1, d) - w(c, b - 1) + w(a - 1, b - 1)
	return ans

def B(a, b, c, d):
	ans = (c - a + 1) * (d - b + 1) - W(a, b, c, d)
	return ans
n = int(input())
for i in range(n):
	(n, m) = map(int, input().split())
	(a, b, c, d) = map(int, input().split())
	(e, f, g, h) = map(int, input().split())
	black = B(1, 1, m, n)
	white = W(1, 1, m, n)
	black = black - B(a, b, c, d)
	white = white + B(a, b, c, d)
	white = white - W(e, f, g, h)
	black = black + W(e, f, g, h)
	if max(a, e) <= min(c, g) and max(b, f) <= min(d, h):
		white = white - B(max(a, e), max(b, f), min(c, g), min(d, h))
		black += B(max(a, e), max(b, f), min(c, g), min(d, h))
	print(white, black)


from collections import namedtuple
Point = namedtuple('Point', ['col', 'row'])
Rectangle = namedtuple('Rectangle', ['start', 'end'])

def NewRect(a, b, c, d):
	return Rectangle(Point(a, b), Point(c, d))

def does_intersect(a, b):
	return b.start.col <= a.end.col and b.start.row <= a.end.row and (b.end.col >= a.start.col) and (b.end.row >= a.start.row)

def contained(a, b):
	return b.start.col <= a.start.col <= b.end.col and b.start.col <= a.end.col <= b.end.col and (b.start.row <= a.start.row <= b.end.row) and (b.start.row <= a.end.row <= b.end.row)

def intersection(a, b):
	assert not contained(a, b)
	assert not contained(b, a)
	assert does_intersect(a, b)
	top = None
	if a.end.row > b.end.row:
		top = b.end.row
	bottom = None
	if a.start.row < b.start.row:
		bottom = b.start.row
	left = None
	if a.start.col < b.start.col:
		left = b.start.col
	right = None
	if a.end.col > b.end.col:
		right = b.end.col
	intersection_start_row = bottom if bottom is not None else a.start.row
	intersection_start_col = left if left is not None else a.start.col
	intersection_end_row = top if top is not None else a.end.row
	intersection_end_col = right if right is not None else a.end.col
	intersect = NewRect(intersection_start_col, intersection_start_row, intersection_end_col, intersection_end_row)
	remaining = []
	if top is not None:
		remaining.append(NewRect(a.start.col, top + 1, a.end.col, a.end.row))
	if bottom is not None:
		remaining.append(NewRect(a.start.col, a.start.row, a.end.col, bottom - 1))
	if left is not None:
		remaining.append(NewRect(a.start.col, intersection_start_row, left - 1, intersection_end_row))
	if right is not None:
		remaining.append(NewRect(right + 1, intersection_start_row, a.end.col, intersection_end_row))
	return (intersect, remaining)

def rectangle_height_and_width(rect):
	return (rect.end.row - rect.start.row + 1, rect.end.col - rect.start.col + 1)

def whites_and_blacks(height, width, start_on_white):
	total = height * width
	whites = total // 2
	blacks = total // 2
	if total % 2 == 1:
		if start_on_white:
			whites += 1
		else:
			blacks += 1
	return (whites, blacks)

def on_white(point):
	return (point.row + point.col) % 2 == 0

def solve(height, width, white, black):
	(total_whites, total_blacks) = whites_and_blacks(height, width, True)
	ignore_white = contained(white, black)
	if not ignore_white:
		(_, blacks) = whites_and_blacks(*rectangle_height_and_width(white), on_white(white.start))
		total_whites += blacks
		total_blacks -= blacks
	if ignore_white or not does_intersect(white, black):
		(whites, _) = whites_and_blacks(*rectangle_height_and_width(black), on_white(black.start))
		total_whites -= whites
		total_blacks += whites
		return (total_whites, total_blacks)
	elif contained(black, white):
		(black_height, black_width) = rectangle_height_and_width(black)
		black_area = black_height * black_width
		total_whites -= black_area
		total_blacks += black_area
		return (total_whites, total_blacks)
	else:
		(intersect, remaining) = intersection(black, white)
		(intersect_height, intersect_width) = rectangle_height_and_width(intersect)
		black_area = intersect_height * intersect_width
		total_whites -= black_area
		total_blacks += black_area
		for rect in remaining:
			(whites, _) = whites_and_blacks(*rectangle_height_and_width(rect), on_white(rect.start))
			total_whites -= whites
			total_blacks += whites
		return (total_whites, total_blacks)
		raise 'Not implemented'
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	(a, b, c, d) = map(int, input().split())
	white = Rectangle(Point(a, b), Point(c, d))
	(a, b, c, d) = map(int, input().split())
	black = Rectangle(Point(a, b), Point(c, d))
	(whites, blacks) = solve(n, m, white, black)
	print(whites, blacks)


t = int(input())
color = [[1, 0], [0, 1]]
(numBlack, numWhite) = (0, 1)
o = []

def A(x1, y1, x2, y2):
	width = x2 - x1 + 1
	height = y2 - y1 + 1
	white = black = 0
	if height & 1 == 0:
		white = black = height // 2 * width
	else:
		white = black = width // 2 * height
		if width & 1 == 1:
			white += height // 2
			black += height // 2
			if color[x1 % 2][y1 % 2] == 0:
				black += 1
			else:
				white += 1
	return [black, white]
for _ 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())
	initialField = A(1, 1, m, n)
	whitePaint = A(x1, y1, x2, y2)
	blackPaint = A(x3, y3, x4, y4)
	blackAfter = initialField[numBlack] + blackPaint[numWhite] - whitePaint[numBlack]
	whiteAfter = initialField[numWhite] + whitePaint[numBlack] - blackPaint[numWhite]
	(isecX1, isecY1, isecX2, isecY2) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	if isecX1 <= isecX2 and isecY1 <= isecY2:
		intersectionInitial = A(isecX1, isecY1, isecX2, isecY2)
		blackAfter += intersectionInitial[numBlack]
		whiteAfter -= intersectionInitial[numBlack]
	o.append('%i %i' % (whiteAfter, blackAfter))
print('\n'.join(o))


k = int(input())
grid_size = []
white_rec = []
black_rec = []
for i in range(k):
	grid = [int(x) for x in input().split()]
	white = [int(x) for x in input().split()]
	black = [int(x) for x in input().split()]
	grid_size.append(grid)
	white_rec.append(white)
	black_rec.append(black)

def count_white(a, b):
	return (a + 1) // 2 * ((b + 1) // 2) + a // 2 * (b // 2)

def count_white_range(a, b, c, d):
	return count_white(c, d) - count_white(a - 1, d) - count_white(c, b - 1) + count_white(a - 1, b - 1)

def count_black_range(a, b, c, d):
	return (c + 1 - a) * (d + 1 - b) - count_white_range(a, b, c, d)

def count_black_white(grid, whites, blacks):
	(m, n) = grid
	white_count = count_white(m, n)
	(w_a, w_b, w_c, w_d) = whites
	white_count += count_black_range(w_a, w_b, w_c, w_d)
	(b_a, b_b, b_c, b_d) = blacks
	white_count -= count_white_range(b_a, b_b, b_c, b_d)
	if max(w_a, b_a) > min(w_c, b_c) or max(w_b, b_b) > min(w_d, b_d):
		return (white_count, m * n - white_count)
	white_count -= count_black_range(max(w_a, b_a), max(w_b, b_b), min(w_c, b_c), min(w_d, b_d))
	return (white_count, m * n - white_count)
for i in range(k):
	(white, black) = count_black_white(grid_size[i], white_rec[i], black_rec[i])
	print('{} {}'.format(white, black))


import math
import sys
T = list(map(int, input().split()))[0]
cT = 0
while cT < T:
	[n, m] = list(map(int, input().split()))
	ran = [[0] * 4, [0] * 4]
	ran[0] = list(map(int, input().split()))
	ran[1] = list(map(int, input().split()))
	black = 0
	white = 0
	if n % 2 == 0 or m % 2 == 0:
		black = n * m // 2
		white = n * m // 2
	else:
		black = n * m // 2
		white = n * m - black
	pos = 0
	w = abs(ran[pos][2] - ran[pos][0]) + 1
	h = abs(ran[pos][3] - ran[pos][1]) + 1
	if w % 2 != 0 and h % 2 != 0:
		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
	w = abs(ran[pos][2] - ran[pos][0]) + 1
	h = abs(ran[pos][3] - ran[pos][1]) + 1
	if w % 2 != 0 and h % 2 != 0:
		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
	pos = 0
	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 and shang2 <= xia2:
		buf = (xia1 - shang1 + 1) * (xia2 - shang2 + 1)
		div = buf // 2
		gb = 0
		if (shang1 + shang2) % 2 != 0:
			gb = buf - div
		else:
			gb = div
		white -= gb
		black += gb
	print('%d %d' % (white, black))
	cT += 1


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)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		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())
(T,) = getIntList()

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 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=' ')


def formvalid(x1, y1, x2, y2):
	if y2 >= y1 and x2 >= x1:
		return 1
	else:
		return 0

def numofblack(n, m, xi, yi):
	total = n * m
	if total % 2 == 1 and abs(yi - xi) % 2 == 1:
		return total // 2 + 1
	elif total % 2 == 1 and abs(yi - xi) % 2 == 0:
		return total // 2
	else:
		return total // 2

def numofwhite(x1, y1, x2, y2):
	n = y2 - y1 + 1
	m = x2 - x1 + 1
	return n * m - numofblack(n, m, x1, y1)
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	m = int(l[1])
	numofb = numofblack(n, m, 1, 1)
	numofw = n * m - numofb
	x = input().split()
	x1 = int(x[0])
	y1 = int(x[1])
	x2 = int(x[2])
	y2 = int(x[3])
	numofb -= numofblack(y2 - y1 + 1, x2 - x1 + 1, x1, y1)
	numofw = n * m - numofb
	x = input().split()
	xx1 = int(x[0])
	yy1 = int(x[1])
	xx2 = int(x[2])
	yy2 = int(x[3])
	xfi1 = max(xx1, x1)
	yfi1 = max(yy1, y1)
	xfi2 = min(xx2, x2)
	yfi2 = min(yy2, y2)
	if formvalid(xfi1, yfi1, xfi2, yfi2) == 0:
		numofw -= numofwhite(xx1, yy1, xx2, yy2)
		numofb = n * m - numofw
	else:
		numofw = numofw - numofwhite(xx1, yy1, xx2, yy2) + numofwhite(xfi1, yfi1, xfi2, yfi2) - (yfi2 - yfi1 + 1) * (xfi2 - xfi1 + 1)
		numofb = n * m - numofw
	print(numofw, numofb)


from collections import defaultdict

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)
	(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
	(B_wh, B_bl) = cols(x3, y3, x4, y4)
	tot_wh += A_bl
	tot_bl -= A_bl
	tot_wh -= B_wh
	tot_bl += B_wh
	return (tot_wh, tot_bl)
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))


from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial

def get(x1, y1, x2, y2):
	a = (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	b = (x2 - x1 + 1) * (y2 - y1 + 1) // 2
	if (x2 - x1 + 1) * (y2 - y1 + 1) & 1:
		if x1 + y1 & 1:
			b += 1
		else:
			a += 1
	return [a, b]

def solution(x1, y1, x2, y2, x3, y3, x4, y4, n, m):
	x11 = max(x1, x3)
	y11 = max(y1, y3)
	x22 = min(x2, x4)
	y22 = min(y2, y4)
	if x11 > x22 or y11 > y22:
		cur = get(1, 1, m, n)
		cur1 = get(x1, y1, x2, y2)
		cur[1] -= cur1[1]
		cur[0] += cur1[1]
		cur1 = get(x3, y3, x4, y4)
		cur[0] -= cur1[0]
		cur[1] += cur1[0]
		return cur
	else:
		cur = get(1, 1, m, n)
		cur1 = get(x11, y11, x22, y22)
		cur2 = get(x1, y1, x2, y2)
		cur3 = get(x3, y3, x4, y4)
		cur[0] -= cur2[0] + cur3[0] - cur1[0]
		cur[1] -= cur2[1] + cur3[1] - cur1[1]
		cur[0] += (x2 - x1 + 1) * (y2 - y1 + 1)
		cur[0] -= (x22 - x11 + 1) * (y22 - y11 + 1)
		cur[1] += (x4 - x3 + 1) * (y4 - y3 + 1)
		return cur
q = int(stdin.readline())
for i in range(q):
	(n, m) = map(int, stdin.readline().split())
	(x1, y1, x2, y2) = map(int, stdin.readline().split())
	(x3, y3, x4, y4) = map(int, stdin.readline().split())
	c = solution(x1, y1, x2, y2, x3, y3, x4, y4, n, m)
	stdout.write(str(c[0]) + ' ' + str(c[1]) + '\n')


__author__ = 'tanunia'
from sys import stdin
t = int(stdin.readline())

def findwb(x1, y1, x2, y2):
	(c_n, c_m) = (x2 - x1 + 1, y2 - y1 + 1)
	if c_n * c_m % 2 == 1:
		(c_w, c_b) = (c_n * c_m // 2 + 1, c_n * c_m // 2)
	else:
		(c_w, c_b) = (c_n * c_m // 2, c_n * c_m // 2)
	if (x1 + y1) % 2 == 0:
		return (c_w, c_b)
	else:
		return (c_b, c_w)
for _ in range(t):
	(n, m) = [int(x) for x in stdin.readline().split()]
	if n * m % 2 == 1:
		(w, b) = (n * m // 2 + 1, n * m // 2)
	else:
		(w, b) = (n * m // 2, n * m // 2)
	(x1, y1, x2, y2) = [int(x) for x in stdin.readline().split()]
	(w1, b1) = findwb(x1, y1, x2, y2)
	w += b1
	b -= b1
	(x3, y3, x4, y4) = [int(x) for x in stdin.readline().split()]
	(w2, b2) = findwb(x3, y3, x4, y4)
	w -= w2
	b += w2
	(x5, y5, x6, y6) = (max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4))
	if x5 <= x6 and y5 <= y6:
		(w3, b3) = findwb(x5, y5, x6, y6)
		w -= b3
		b += b3
	print(str(w) + ' ' + str(b))


def belyh(x, y, xx, yy):
	ans = (xx - x + 1) * (yy - y + 1) // 2
	if (xx - x + 1) * (yy - y + 1) % 2 == 1:
		if (x + y) % 2 == 0:
			ans += 1
	return ans

def chern(x, y, xx, yy):
	return (xx - x + 1) * (yy - y + 1) - belyh(x, y, xx, yy)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(x1, y1, x2, y2) = map(int, input().split())
	(x3, y3, x4, y4) = map(int, input().split())
	(x5, x6, y5, y6) = (max(x1, x3), min(x2, x4), max(y1, y3), min(y2, y4))
	shw = belyh(1, 1, n, m) - belyh(x3, y3, x4, y4) + chern(x1, y1, x2, y2)
	if x5 <= x6 and y5 <= y6:
		shw -= chern(x5, y5, x6, y6)
	w = shw
	b = n * m - w
	print(w, b)