#include "algotester.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[])
{
auto readers = initChecker(argc, argv);
auto test = readers[0];
auto user = readers[1];
int q = test.readInt();
while(q--){
auto a = test.readInt();
auto b = test.readInt();
auto x = user.readInt(0, 2'000'000'000);
auto y = user.readInt(0, 2'000'000'000);
check(2 * (a * a + b * b) == x * x + y * y, "Wrong answer");
}
user.readEof();
return 0;
}