#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <queue>
#include <cassert>

using namespace std;

vector<vector<int> > field;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

void assert_coord(int c)
{
	assert(c >= 0 && c <= 100);
}

void bfs(int x, int y, int h)
{
	queue<int> qx;
	queue<int> qy;

	field[x][y] = h;
	qx.push(x);
	qy.push(y);

	while (!qx.empty())
	{
		int vx, vy;
		vx = qx.front();
		vy = qy.front();
		qx.pop();
		qy.pop();

		for (int i = 0;i < 4;i++)
		{
			int nx = vx + dx[i];
			int ny = vy + dy[i];
			if (nx >= 0 && ny >= 0 && field[nx][ny] > 0)
			{
				field[nx][ny] = h;
				qx.push(nx);
				qy.push(ny);
			}
		}
	}
}

int main()
{
	ifstream in("boxes.in");

	int tc;
	in >>tc;
	while (tc--)
	{
		int N;
		in >>N;
		assert(N <= 25);

		field.assign(102, vector<int>(102, 0));
		int height = 1;
		for (int i = 0;i < N;i++, height++)
		{
			int x1, y1, x2, y2;
			in >>x1>> y1>> x2>> y2;
	
			assert_coord(x1);
			assert_coord(x2);
			assert_coord(y1);
			assert_coord(y2);
			assert(x2 > x1);
			assert(y2 > y1);

			int cur_height = 0;
			for (int x = x1;x < x2;x++)
				for (int y = y1;y < y2;y++)
					field[x][y] = height;
		}

		height = -1;
		for (int x = 0;x < field.size();x++)
			for (int y = 0;y < field[0].size();y++)
				if (field[x][y] > 0)
					bfs(x, y, height--);

		int res = 0;
		for (int h = height;h < 0;h++)
		{
			int cur = 0;
			for (int x = 0;x < field.size();x++)
				for (int y = 0;y < field[0].size();y++)
					cur += field[x][y] == h;
			res = max(cur, res);
		}
		cout <<res <<endl;
	}

	return 0;
}
