#K45922. Right Triangle Checker

    ID: 27861 Type: Default 1000ms 256MiB

Right Triangle Checker

Right Triangle Checker

This problem asks you to determine whether three given points in the plane form a right triangle. A triangle is a right triangle if one of its angles is exactly 90°. In terms of side lengths, if the squared distances of the sides are \(a^2\), \(b^2\), and \(c^2\) where \(c\) is the longest side, the triangle is right-angled if and only if \(a^2 + b^2 = c^2\). Your task is to process multiple queries and, for each set of points, output "YES" if they form a right triangle, or "NO" otherwise.

Note: All input is read from standard input and all output is written to standard output.

inputFormat

The first line of input contains a single integer \(T\) (\(1 \le T \le 10^4\)) representing the number of queries. Each of the next \(T\) lines contains six integers \(x_1, y_1, x_2, y_2, x_3, y_3\) separated by spaces, representing the coordinates of the three points.

outputFormat

For each query, output a single line containing either "YES" if the points form a right triangle, or "NO" otherwise.

## sample
3
0 0 3 4 3 0
1 1 4 1 1 5
2 3 4 6 8 2
YES

YES NO

</p>