1import math
2t=int(input())
3for i in range(t):
4 r=int(input())
5 x1,y1=map(int,input().split())
6 x2,y2=map(int,input().split())
7 x3,y3=map(int,input().split())
8 a=math.sqrt((x1-x2)**2+(y1-y2)**2)
9 b=math.sqrt((x1-x3)**2+(y1-y3)**2)
10 c=math.sqrt((x2-x3)**2+(y2-y3)**2)
11 if r>=a and r>=b:
12 print("yes")
13 elif r>=c and(r>=a or r>=b):
14 print("yes")
15 else:
16 print("no")
17
18