P10882 [HackerEarth] autocorrect
普及
题目描述

Rachel, being an awesome android programmer, just finished an App that will let us draw a triangle by selecting three points on the touch-plane.Now She asks her friend Bruce to draw a Right-Angled Triangle (we'll call it RAT) by selecting 3 integral points on the plane.
A RAT is a triangle with Non-Zero area and a right-angle.

But Bruce, being in a hurry as always, makes a mistake on drawing the points. Now Rachel's app can fix Bruce's mistake if only one coordinate of any one point can be adjusted within a distance of 1 units. i.e., if the drawn triangle can be made a RAT by adjusting any one coordinate within 1 unit of distance.

Your task is simple, given 6 coordinates (each Integer pair representing a point), you have to tell can Rachel's app correct Bruce's mistake automatically?

Input:

  First line containing T, the number of test cases.
  Then T lines follow with 6 space separated coordinates.

Output:

  print "YES" in a newline if it's possible.
  otherwise print "NO" in a newline.

Constraints:

  1 ≤ T ≤ 100
  -1000 ≤ xi,yi ≤ 1000

SAMPLE INPUT
3
-1 0 2 0 0 1
2 3 4 5 6 6
0 0 2 0 10 10

SAMPLE OUTPUT
YES
NO
NO

Explanation

Case 1: For (-1, 0), (2, 0) and (0, 1), shifting (-1, 0) to (0, 0) makes it a RAT.

Case 2 and Case 3: No any possible shift results into a RAT.

Note that any point can be moved either in x- or in y- direction at a time by 1 unit.

输入格式

见题面

输出格式

见题面

样例输入
3 -1 0 2 0 0 1 2 3 4 5 6 6 0 0 2 0 10 10 SAMPLE
样例输出
YES NO NO