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.
import sys
import math
epsilon = 1e-7
def check(x1,y1,x2,y2,x3,y3):
	
	d1 = (x1-x2)**2+(y1-y2)**2
	d2 = (x1-x3)**2+(y1-y3)**2
	d3 = (x3-x2)**2+(y3-y2)**2
	if abs(math.sqrt(d1)+math.sqrt(d2)-math.sqrt(d3))<epsilon:
		return False
	if abs(math.sqrt(d1)+math.sqrt(d3)-math.sqrt(d2))<epsilon:
		return False
	if abs(math.sqrt(d3)+math.sqrt(d2)-math.sqrt(d1))<epsilon:
		return False
	return d1+d2==d3 or d2+d3==d1 or d3+d1==d2
for t in xrange(input()):
	x1,y1,x2,y2,x3,y3 = map(float,sys.stdin.readline().split())
	if check(x1,y1,x2,y2,x3,y3): 
		print "YES"
		continue
	ok = False
	i = -1.0
	while i<=1.0:
		if check(x1+i,y1,x2,y2,x3,y3): 
			print "YES"
			ok = True
			break
		if check(x1,y1+i,x2,y2,x3,y3): 
			print "YES"
			ok = True
			break
		if check(x1,y1,x2+i,y2,x3,y3): 
			print "YES"
			ok = True
			break
		if check(x1,y1,x2,y2+i,x3,y3): 
			print "YES"
			ok = True
			break
		if check(x1,y1,x2,y2,x3+i,y3): 
			print "YES"
			ok = True
			break
		if check(x1,y1,x2,y2,x3,y3+i): 
			print "YES"
			ok = True
			break
		i += 0.5
	if not ok:
		print "NO"