#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll gcd(ll a, ll b)
{
if(b == 0)
return a;
return gcd(b, a%b);
}
int main()
{
int t, i = 1;
cin >> t;
while(t--)
{
ll x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
ll r1 = abs(x1-x2), r2 = abs(y1-y2);
cout << "Case " << i++ << ": " << gcd(r1, r2)+1 << "\n";
}
return 0;
}
Comments
Post a Comment