Read problems statements in Mandarin chinese, Russian and Vietnamese as well. 

You are given four integers a, b, c and d. Determine if there's a rectangle such that the lengths of its sides are a, b, c and d (in any order).

------ Input ------ 

The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains four space-separated integers a, b, c and d.

------ Output ------ 

For each test case, print a single line containing one string "YES" or "NO".

------ Constraints ------ 

$1 ≤ T ≤ 1,000$
$1 ≤ a, b, c, d ≤ 10,000$

------ Subtasks ------ 

Subtask #1 (100 points): original constraints

----- Sample Input 1 ------ 
3

1 1 2 2

3 2 2 3

1 2 2 2
----- Sample Output 1 ------ 
YES

YES

NO

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
for _ in range(int(input())):
	a = list(input().split())
	s = set(a)
	print('YES' if len(s) == 1 or (len(s) == 2 and a.count(a[0]) == 2) else 'NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if a == b and c == d:
		print('YES')
	elif a == c and b == d:
		print('YES')
	elif a == d and b == c:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	s = list(input().split())
	if s[0] == s[1] and s[2] == s[3] or (s[1] == s[2] and s[0] == s[3]) or (s[0] == s[2] and s[1] == s[3]):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split(' '))
	if a == b and c == d or (a == c and b == d) or (a == d and b == c):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	set_a = set(a)
	count = 0
	if len(set_a) == 1:
		print('YES')
	else:
		for i in set_a:
			if a.count(i) == 2:
				count += 1
		if count == 2:
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	a = list(map(int, input().split()))
	a.sort()
	if a[0] == a[1] and a[2] == a[3]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	l = list(map(int, input().split()))
	d = dict()
	for i in l:
		if i in d.keys():
			d[i] += 1
		else:
			d[i] = 1
	c = 0
	for i in d.keys():
		if d.get(i) % 2 == 0:
			c += 1
	if c == len(d.keys()):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	l.sort()
	if l[0] == l[1] and l[2] == l[3]:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	Sides = list(map(int, input().split()))
	flag = 1
	for i in Sides:
		if Sides.count(i) != 2 and Sides.count(i) != 4:
			flag = 0
			break
	print('YES' if flag == 1 else 'NO')


from collections import Counter
for i in range(int(input())):
	l = list(map(int, input().split()))
	l.sort()
	if l[0] == l[1] and l[2] == l[3]:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	x = [a, b, c, d]
	x.sort()
	if x[0] == x[1] and x[2] == x[3]:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	inp = input()
	list_ = inp.split(' ')
	for i in range(len(list_)):
		list_[i] = int(list_[i])
	res_1 = ''
	res_2 = ''
	for i in list_:
		if list_.count(i) == 2 or list_.count(i) == 4:
			res_1 = 'YES'
		else:
			res_2 = 'NO'
	if res_1 == 'YES' and res_2 != 'NO':
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	l = list(map(int, input().split()))
	s = set(l)
	for i in s:
		if l.count(i) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	l1 = list(map(int, input().split()))
	s1 = set(l1)
	if len(s1) == 1:
		print('YES')
	elif len(s1) == 2:
		count = 0
		for i in s1:
			if l1.count(i) == 2:
				count = count + 1
		if count == 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for t in range(int(input())):
	length = list(map(int, input().split(' ')))
	a = set(length)
	if len(a) == 1:
		print('YES')
	elif len(a) == 2:
		if length.count(length[0]) == 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


l = int(input())
for i in range(l):
	(a, b, c, d) = map(int, input().split())
	if a in [b, c, d]:
		q = [b, c, d]
		q.remove(a)
		if q[1] != q[0]:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	rec = list(map(int, input().split()))
	rec.sort()
	if rec[0] == rec[1] and rec[2] == rec[3]:
		print('YES')
	else:
		print('NO')
	t -= 1


for tc in range(int(input())):
	arr = list(map(int, input().split()))
	arr2 = []
	for i in arr:
		arr2.append(arr.count(i))
	if 0 not in arr and (arr2.count(2) == 4 or 4 in arr2):
		print('YES')
	else:
		print('NO')


p = int(input())
for i in range(p):
	(a, b, c, d) = map(int, input().split())
	if a in [b, c, d]:
		k = [b, c, d]
		k.remove(a)
		if k[0] == k[1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for vdbnnn in range(int(input())):
	my_inputa = [int(my_inputx) for my_inputx in input().split()]
	my_inputs = list(set(my_inputa))
	if len(my_inputs) == 2 and my_inputa.count(my_inputs[0]) == 2 and (my_inputa.count(my_inputs[1]) == 2) or len(my_inputs) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	p = list(map(int, input().split()))[:4]
	p.sort()
	if p[0] == p[1] and p[2] == p[3]:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	l = list(map(int, input().split()))[:4]
	l.sort()
	if l[0] == l[1] and l[2] == l[3]:
		print('YES')
	else:
		print('NO')