#include <iostream>
#define MOD(a) ((a)>0 ? (a) : -(a))
using namespace std;

int main()
{
	freopen("segment.in","r",stdin);
	int x1,x2,y1,y2,px,py,N;
	cin >> N;
	for(int i = 0; i < N; i++)
	{
		cin >> x1 >> y1 >> x2 >> y2;
		px=MOD((x1-x2));
		py=MOD((y1-y2));
		if(px == 0)
		{
			cout << py+1 << endl;
		}
		else if(py == 0)
		{
			cout << px+1 << endl;
		}
		else if(px > py)
		{
			cout << (px*px/py)+1 << endl;
		}
		else
		{
			cout << (py*py/px)+1 << endl;
		}
	}
	return 0;
}