#include<iostream>
#include<fstream>
#include<math.h>
#include<cmath>
using namespace std;


int main()
{
	ifstream in("SEGMENT.IN");
	int n;
	int x1,y1,x2,y2;
	int x,dx,dy;
	double k,b;

	in>>n;

	while(n--)
	{
		in>>x1>>y1>>x2>>y2;

		dx=(abs(x1-x2));
		dy=(abs(y1-y2));
		


		if (dx>dy)
		{
			if (dy==0) k=1;
			else
			k=dx/dy;
			cout<<dx/k+1<<endl;
		}
		else
		{
			if (dx==0) k=1;
			else
			k=dy/dx;
			cout<<dy/k+1<<endl;
		}
	}
	
	return 0;
}
		




