cho.sh
Notes
Loading...

Square

Time limit

1s

Memory limit

512 MB

Problem

You are given the coordinates of four distinct points. Determine whether all four points can be used as the vertices of a square.

Input

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.

Output

For each test case, print 1 on its own line if the four given points can form a square. Otherwise, print 0.