In ACM-ICPC contests, there are usually three people in a team. For each person in the team, you know their scores in three skills - hard work, intelligence and persistence.
You want to check whether it is possible to order these people (assign them numbers from 1 to 3) in such a way that for each 1 ≤ i ≤ 2, i+1-th person is stricly better than the i-th person.
A person x is said to be better than another person y if x doesn't score less than y in any of the skills and scores more than y in at least one skill.
Determine whether such an ordering exists.

-----Input-----
The first line fo the input contains an integer T denoting the number of test cases.
Each test consists of three lines. Each of these lines contains three space separated integers s1, s2 and s3 denoting the scores of one member of the team in each of the three skills, in the given order.

-----Output-----
For each test case, output a single line containing "yes" if such an ordering exists or "no" if doesn't exist (without quotes).

-----Constraints-----
- 1 ≤ T ≤ 1000
- 1 ≤ s1, s2, s3 ≤ 100

-----Example-----
Input
3
1 2 3
2 3 4
2 3 5
1 2 3
2 3 4
2 3 4
5 6 5
1 2 3
2 3 4

Output
yes
no
yes

-----Explanation-----
Test Case 1: We can order them as (3, 2, 1). Person 3 is better than Person 2 because his scores in the first two skills are not lesser than Person 2's. And in skill 3, Person 3 scores higher. Similarly, Person 2 is better than Person 1. He scores more than Person 1 in every skill, in fact.

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
def g(x, y):
	d = x[0] >= y[0] and x[1] >= y[1] and (x[2] >= y[2])
	e = x[0] > y[0] or x[1] > y[1] or x[2] > y[2]
	return d and e
t = int(input())
for _ in range(t):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	if g(a, b) and g(b, c):
		print('yes')
	elif g(a, c) and g(c, b):
		print('yes')
	elif g(b, a) and g(a, c):
		print('yes')
	elif g(b, c) and g(c, a):
		print('yes')
	elif g(c, a) and g(a, b):
		print('yes')
	elif g(c, b) and g(b, a):
		print('yes')
	else:
		print('no')


tcase = int(input())
while tcase > 0:
	scores = []
	for test in range(3):
		points = list(map(int, input().split()))
		scores.append(points)
	scores = sorted(scores)
	answer = 'yes'
	count_01 = 0
	count_12 = 0
	for j in range(3):
		if scores[0][j] < scores[1][j]:
			count_01 = 1
		if scores[1][j] < scores[2][j]:
			count_12 = 1
		if scores[0][j] > scores[1][j] or scores[1][j] > scores[2][j]:
			answer = 'no'
			break
		elif (count_01 == 0 or count_12 == 0) and j == 2:
			answer = 'no'
	print(answer)
	tcase -= 1


def is_better(x, y):
	for i in range(3):
		if s[y][i] > s[x][i]:
			return 0
	for i in range(3):
		if s[x][i] > s[y][i]:
			return 1
	return 0
t = int(input())
for _ in range(t):
	s = []
	for i in range(3):
		s.append([int(x) for x in input().split()])
	f = -1
	m = -1
	flag = 1
	if is_better(0, 1) and is_better(0, 2):
		f = 0
	elif is_better(1, 0) and is_better(1, 2):
		f = 1
	elif is_better(2, 0) and is_better(2, 1):
		f = 2
	else:
		flag = 0
	if f != -1:
		temp = [0, 1, 2]
		temp.remove(f)
		if is_better(temp[0], temp[1]):
			m = temp[0]
		elif is_better(temp[1], temp[0]):
			m = temp[1]
		else:
			flag = 0
	if flag == 0:
		print('no')
	else:
		print('yes')


t = int(input())
for i in range(t):
	list1 = []
	for i in range(3):
		list1.append(list(map(int, input().split())))
	min1 = min(list1[0][0], list1[1][0], list1[2][0])
	min2 = min(list1[0][1], list1[1][1], list1[2][1])
	min3 = min(list1[0][2], list1[1][2], list1[2][2])
	max1 = max(list1[0][0], list1[1][0], list1[2][0])
	max2 = max(list1[0][1], list1[1][1], list1[2][1])
	max3 = max(list1[0][2], list1[1][2], list1[2][2])
	list2 = []
	list3 = []
	list2 = [min1, min2, min3]
	list3 = [max1, max2, max3]
	if list2 not in list1 or list3 not in list1:
		print('no')
	elif list2 in list1 and list3 in list1:
		list1.remove(list2)
		list1.remove(list3)
		if list1[0] != list2 and list1[0] != list3:
			print('yes')
		else:
			print('no')