Time limit
1s
Memory limit
512 MB
You are given the coordinates of four distinct points. Determine whether all four points can be used as the vertices of a square.
The first line contains the number of test cases, T. Each test case consists of four lines. Each of those lines contains the coordinates x y of one point. Every coordinate is an integer between -100000 and 100000, inclusive, and no point appears more than once in the same test case.
For each test case, print 1 on its own line if the four given points can form a square. Otherwise, print 0.