import sys
nabory = int(sys.stdin.readline())
# n = int(sys.stdin.readline())
def solv():
    try:
        for i in range(nabory):
            n = int(input())
            try:
                for temp in range(n):
                    temp += sum(map(int, input().split()))
                    temp // 4000
            except EOFError:
                break
            for j in range(n):
                nums = (int, input().split())
                if(2 <= temp and temp <= n - 1):
                    if(nums[-1] + nums[1] >= 2 * nums[1]):
                        print("YES")
                else:
                    print("NO")
				
    except ValueError:
        print("NO")
    
            
if __name__ == '__main__':
	print(solv())
