#include<iostream>
#include<vector>
#include<algorithm>
#include<optional>
#include<string>
#include<iomanip>
#include<cctype>
#include<random>
#include<array>
#include<map>
#include<queue>
#include<functional>
#include<set>
#include<chrono>

#ifdef _MSC_FULL_VER
#include"randomizer.hpp"
#include"debug_print.hpp"
#endif


namespace lib
{
	template<class T>using pair = std::pair<T, T>;
	template<class T>constexpr T pow(T base, std::size_t p)
	{
		return p == 0 ? T(1) :
			p == 1 ? base :
			p == 2 ? base * base :
			p % 2 == 0 ? pow(pow(base, p / 2), 2) :
			base * pow(pow(base, p / 2), 2);
	}

	template<class T>constexpr T gcd(T a, T b)
	{
		return a > b ? gcd(b, a) : a == T() ? b : gcd(b%a, a);
	}

	constexpr int intlog2(std::int64_t x)
	{
		std::int64_t j = 2;
		for (auto i = 0; i < 63; ++i)
		{
			if (j > x)
			{
				return int(i);
			}
			j <<= 1;
		}
		return 63;
	}

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

	struct union_find_light
	{
		std::vector<int> upper;
		union_find_light(std::size_t size):upper(size, -1) {}

		int group(int index)
		{
			if (upper[index] == -1)
			{
				return index;
			}
			else
			{
				auto ret = group(upper[index]);
				upper[index] = ret;
				return ret;
			}
		}

		bool merge(int x, int y)
		{
			auto gx = group(x);
			auto gy = group(y);
			if (gx != gy)
			{
				upper[gx] = gy;
				return true;
			}
			return false;
		}

		auto get()
		{
			std::map<int, std::set<int>> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret[group(i)].emplace(i);
			}
			return ret;
		}

		auto tops()
		{
			std::set<int> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret.emplace(group(i));
			}
			return ret;
		}

		bool is_same_group(int x, int y)
		{
			return group(x) == group(y);
		}
	};
}

namespace out
{
	namespace detail
	{
		template<class>struct void_out
		{
			typedef void type;
		};
		template<class T>auto write(std::ostream& ost, T const& val)
			->typename void_out<decltype(ost << val)>::type
		{
			ost << val;
		}
		template<class T, class... Ts>void write(std::ostream& ost, T const& val, Ts const&... nexts)
		{
			write(ost, val);
			ost << " ";
			write(ost, nexts...);
		}
	}
	void write_line()
	{
		std::cout << std::endl;
	}
	template<class...Ts>void write_line(Ts const&... args)
	{
		detail::write(std::cout, args...);
		std::cout << std::endl;
	}
	template<class Range>void write_range(Range const& rng)
	{
		for (auto const& v : rng)
		{
			write_line(v);
		}
	}
}

lib::pair<std::int64_t> run(std::int64_t n, std::int64_t m,
	std::array<std::int64_t, 4> xs,
	std::array<std::int64_t, 4> ys)
{
	auto[x0, x1, x2, x3] = xs;
	auto[y0, y1, y2, y3] = ys;
	auto white = (n * m) / 2 + bool((n * m) % 2);
	auto black = (n * m) / 2;
	auto X0 = x1 - x0 + 1;
	auto Y0 = y1 - y0 + 1;
	auto X1 = x3 - x2 + 1;
	auto Y1 = y3 - y2 + 1;
	auto c0 = (X0*Y0) / 2 + bool((X0*Y0) % 2);
	auto c1 = (X0*Y0) / 2;
	auto c2 = (X1*Y1) / 2 + bool((X1*Y1) % 2);
	auto c3 = (X1*Y1) / 2;
	auto w = X0 * Y0;
	auto b = X1 * Y1;
	if ((X0*Y0) % 2 == 0)
	{
		white -= c1;
		black -= c1;
	}
	else if ((x0 + y0) % 2 == 0)
	{
		white -= c0;
		black -= c1;
	}
	else
	{
		white -= c1;
		black -= c0;
	}
	if ((X1*Y1) % 2 == 0)
	{
		white -= c3;
		black -= c3;
	}
	else if ((x2 + y2) % 2 == 0)
	{
		white -= c2;
		black -= c3;
	}
	else
	{
		white -= c3;
		black -= c2;
	}

	auto x5 = std::max(x0, x2);
	auto x6 = std::min(x1, x3);
	auto y5 = std::max(y0, y2);
	auto y6 = std::min(y1, y3);
	if (x5 <= x6 && y5 <= y6)
	{
		auto X2 = x6 - x5 + 1;
		auto Y2 = y6 - y5 + 1;
		auto c5 = (X2*Y2) / 2 + bool((X2*Y2) % 2);
		auto c6 = (X2*Y2) / 2;
		w -= X2 * Y2;
		if ((X2*Y2) % 2 == 0)
		{
			white += c6;
			black += c6;
		}
		else if ((x5 + y5) % 2 == 0)
		{
			white += c5;
			black += c6;
		}
		else
		{
			white += c6;
			black += c5;
		}
	}
	return std::make_pair(white + w, black + b);
}

void Main()
{
	int Q;
	std::cin >> Q;
	for (int i = 0; i < Q; ++i)
	{
		std::int64_t n, m;
		std::cin >> m >> n;
		std::int64_t x0, x1, x2, x3, y0, y1, y2, y3;
		std::cin >> x0 >> y0 >> x1 >> y1;
		std::cin >> x2 >> y2 >> x3 >> y3;
		auto[w, b] = run(n, m, { x0,x1,x2,x3 }, { y0,y1,y2,y3 });
		out::write_line(w, b);
	}

}

int main()
{
	std::cin.tie(nullptr);
	std::cin.sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}