Alex, Bob, and, Chef are standing on the coordinate plane. Chef is standing at the origin (coordinates (0, 0)) while the location of Alex and Bob are (X_{1}, Y_{1}) and (X_{2}, Y_{2}) respectively.

Amongst Alex and Bob, find out who is at a farther distance from Chef or determine if both are at the same distance from Chef.

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- The first and only line of each test case contains four space-separated integers X_{1}, Y_{1}, X_{2}, and Y_{2} — the coordinates of Alex and Bob.

------ Output Format ------ 

For each test case, output on a new line:
- ALEX, if Alex is at a farther distance from Chef.
- BOB, if Bob is at a farther distance from Chef.
- EQUAL, if both are standing at the same distance from Chef.

You may print each character in uppercase or lowercase. For example, Bob, BOB, bob, and bOB, are all considered identical.

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

$1 ≤ T ≤ 2000$
$-1000 ≤ X_{1}, Y_{1}, X_{2}, Y_{2} ≤ 1000$

----- Sample Input 1 ------ 
3
-1 0 3 4
3 4 -4 -3
8 -6 0 5

----- Sample Output 1 ------ 
BOB
EQUAL
ALEX
----- explanation 1 ------ 
Test case $1$: Alex is at a distance $1$ from Chef while Bob is at distance $5$ from Chef. Thus, Bob is at a farther distance.

Test case $2$: Alex is at a distance $5$ from Chef and Bob is also at distance $5$ from Chef. Thus, both are at the same distance.

Test case $3$: Alex is at a distance $10$ from Chef while Bob is at distance $5$ from Chef. Thus, Alex is at a farther distance.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
import math
for _ in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	d = math.sqrt(x1 ** 2 + y1 ** 2)
	d2 = math.sqrt(x2 ** 2 + y2 ** 2)
	if d == d2:
		print('EQUAL')
	elif d > d2:
		print('ALEX')
	else:
		print('BOB')


import math
t = int(input())
for i in range(t):
	(x1, y1, x2, y2) = list(map(int, input().split()))
	a = math.sqrt(x1 ** 2 + y1 ** 2)
	b = math.sqrt(x2 ** 2 + y2 ** 2)
	if a > b:
		print('ALEX')
	elif b > a:
		print('BOB')
	else:
		print('EQUAL')


def distance(pos):
	final_distance = (0 - pos[0]) ** 2 + (0 - pos[1]) ** 2
	return int(final_distance)
t = int(input())
for _ in range(t):
	positions = list(map(int, input().split()))
	alex_position = positions[:2]
	bob_position = positions[2:]
	alex_distance = distance(alex_position)
	bob_distance = distance(bob_position)
	distances = lambda x, y: 'BOB' if y > x else 'ALEX' if x > y else 'EQUAL'
	print(distances(alex_distance, bob_distance))


for i in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	d1 = (x1 ** 2 + y1 ** 2) ** 0.5
	d2 = (x2 ** 2 + y2 ** 2) ** 0.5
	if d1 > d2:
		print('ALEX')
	elif d1 == d2:
		print('EQUAL')
	else:
		print('BOB')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if (a ** 2 + b ** 2) ** 0.5 > (c ** 2 + d ** 2) ** 0.5:
		print('ALEX')
	elif (a ** 2 + b ** 2) ** 0.5 < (c ** 2 + d ** 2) ** 0.5:
		print('BOB')
	else:
		print('EQUAL')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	alex = pow(a, 2) + pow(b, 2)
	bob = pow(c, 2) + pow(d, 2)
	if alex > bob:
		print('ALEX')
	elif alex < bob:
		print('BOB')
	else:
		print('EQUAL')


t = int(input())
for i in range(t):
	(x1, y1, x2, y2) = map(int, input().split())
	l = pow(x1, 2) + pow(y1, 2)
	m = pow(x2, 2) + pow(y2, 2)
	if l < m:
		print('BOB')
	elif l > m:
		print('ALEX')
	else:
		print('EQUAL')


import math
for i in range(int(input())):
	(x, y, x1, y1) = map(int, input().split())
	al = abs(x - 0) ** 2 + abs(y - 0) ** 2
	bo = abs(x1 - 0) ** 2 + abs(y1 - 0) ** 2
	c = pow(al, 0.5)
	d = pow(bo, 0.5)
	if c > d:
		print('ALEX')
	elif d > c:
		print('BOB')
	else:
		print('EQUAL')


from math import sqrt
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	e = sqrt(a ** 2 + b ** 2)
	f = sqrt(c ** 2 + d ** 2)
	if e < f:
		print('BOB')
	elif e > f:
		print('ALEX')
	else:
		print('EQUAL')


import math
T = int(input())
for i in range(T):
	(x1, y1, x2, y2) = map(int, input().split())
	if math.sqrt(x1 ** 2 + y1 ** 2) > math.sqrt(x2 ** 2 + y2 ** 2):
		print('ALEX')
	elif math.sqrt(x1 ** 2 + y1 ** 2) < math.sqrt(x2 ** 2 + y2 ** 2):
		print('BOB')
	else:
		print('EQUAL')


for i in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	a = x1 * x1 + y1 * y1
	b = x2 * x2 + y2 * y2
	if a > b:
		print('ALEX')
	elif a == b:
		print('EQUAL')
	else:
		print('BOB')


import math
t = int(input())
for _ in range(t):
	(x1, y1, x2, y2) = map(int, input().split())
	dist1 = math.sqrt(x1 ** 2 + y1 ** 2)
	dist2 = math.sqrt(x2 ** 2 + y2 ** 2)
	if dist1 > dist2:
		print('ALEX')
	elif dist2 > dist1:
		print('BOB')
	else:
		print('EQUAL')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	x = a * a + b * b
	y = c * c + d * d
	if x > y:
		print('ALEX')
	elif y > x:
		print('BOB')
	else:
		print('EQUAL')


import math
t = int(input())
for i in range(t):
	(x, y, x2, y2) = map(int, input().split())
	a = math.sqrt((x - 0) ** 2 + (y - 0) ** 2)
	b = math.sqrt((x2 - 0) ** 2 + (y2 - 0) ** 2)
	if a > b:
		print('ALEX')
	elif a == b:
		print('EQUAL')
	else:
		print('BOB')


t = int(input())
for i in range(t):
	(x1, y1, x2, y2) = map(int, input().split())
	dis_a = x1 ** 2 + y1 ** 2
	dis_b = x2 ** 2 + y2 ** 2
	if dis_a > dis_b:
		print('ALEX')
	elif dis_b > dis_a:
		print('BOB')
	else:
		print('EQUAL')


T = int(input())
for i in range(T):
	(x1, y1, x2, y2) = map(int, input().split())
	alex = x1 * x1 + y1 * y1
	bob = x2 * x2 + y2 * y2
	if alex == bob:
		print('EQUAL')
	elif alex > bob:
		print('ALEX')
	else:
		print('BOB')


T = int(input())
for _ in range(T):
	(X1, Y1, X2, Y2) = map(int, input().split())
	Alex_distance = X1 * X1 + Y1 * Y1
	Bob_distance = X2 * X2 + Y2 * Y2
	if Alex_distance == Bob_distance:
		print('EQUAL')
	elif Alex_distance > Bob_distance:
		print('ALEX')
	else:
		print('BOB')


T = int(input())
for tc in range(T):
	(x1, y1, x2, y2) = map(int, input().split(' '))
	d1 = x1 ** 2 + y1 ** 2
	d2 = x2 ** 2 + y2 ** 2
	if d1 > d2:
		print('ALEX')
	elif d1 == d2:
		print('EQUAL')
	else:
		print('BOB')


import math as m
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	x = m.sqrt(a ** 2 + b ** 2)
	y = m.sqrt(c ** 2 + d ** 2)
	if x > y:
		print('ALEX')
	elif x < y:
		print('BOB')
	else:
		print('EQUAL')


T = int(input())
while T > 0:
	(X1, Y1, X2, Y2) = map(int, input().split())
	if (X1 * X1 + Y1 * Y1) * 0.5 > (X2 * X2 + Y2 * Y2) * 0.5:
		print('ALEX')
	elif (X1 * X1 + Y1 * Y1) * 0.5 == (X2 * X2 + Y2 * Y2) * 0.5:
		print('EQUAL')
	else:
		print('BOB')
	T = T - 1


import math
t = int(input())
for i in range(t):
	(X1, Y1, X2, Y2) = map(int, input().split())
	if math.sqrt(X1 * X1 + Y1 * Y1) > math.sqrt(X2 * X2 + Y2 * Y2):
		print('ALEX')
	elif math.sqrt(X1 * X1 + Y1 * Y1) < math.sqrt(X2 * X2 + Y2 * Y2):
		print('BOB')
	else:
		print('EQUAL')


import math
t = int(input())
for i in range(0, t):
	(x1, y1, x2, y2) = map(int, input().split())
	d1 = math.sqrt(x1 * x1 + y1 * y1)
	d2 = math.sqrt(x2 * x2 + y2 * y2)
	if d1 > d2:
		print('ALEX')
	elif d2 > d1:
		print('BOB')
	else:
		print('EQUAL')


import math
tc = int(input())
for x in range(tc):
	str = input().split(' ')
	ax = int(str[0])
	ay = int(str[1])
	bx = int(str[2])
	by = int(str[3])
	dx = math.sqrt(pow(abs(ax), 2) + pow(abs(ay), 2))
	dy = math.sqrt(pow(abs(bx), 2) + pow(abs(by), 2))
	if dx < dy:
		print('BOB')
	elif dx == dy:
		print('EQUAL')
	else:
		print('ALEX')


T = int(input())
for i in range(T):
	(X1, Y1, X2, Y2) = map(int, input().split())
	u = (X1 ** 2 + Y1 ** 2) ** 0.5
	s = (X2 ** 2 + Y2 ** 2) ** 0.5
	if u > s:
		print('ALEX')
	elif u < s:
		print('BOB')
	else:
		print('EQUAL')


import math
n = int(input())
for i in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	alex = math.sqrt(a ** 2 + b ** 2)
	bob = math.sqrt(c ** 2 + d ** 2)
	if alex > bob:
		print('ALEX')
	elif bob > alex:
		print('BOB')
	else:
		print('EQUAL')


for _ in range(int(input())):
	(x, y, a, b) = map(int, input().split())
	x1 = x * x
	y1 = y * y
	a1 = a * a
	b1 = b * b
	p = x1 + y1
	q = a1 + b1
	if p > q:
		print('ALEX')
	elif p < q:
		print('BOB')
	else:
		print('EQUAL')


t = int(input())
while t > 0:
	(x1, y1, x2, y2) = map(int, input().split())
	a = pow(x1, 2) + pow(y1, 2)
	b = pow(x2, 2) + pow(y2, 2)
	if a > b:
		print('ALEX')
	elif b > a:
		print('BOB')
	elif a == b:
		print('EQUAL')
	t -= 1


t = int(input())
for _ in range(t):
	(x, y, x2, y2) = list(map(int, input().split()))
	d1 = pow(x, 2) + pow(y, 2)
	d2 = pow(x2, 2) + pow(y2, 2)
	if d1 < d2:
		print('BOB')
	elif d1 > d2:
		print('ALEX')
	else:
		print('EQUAL')


import math
t = int(input())
res = float()
for i in range(t):
	(x1, y1, x2, y2) = map(int, input().split())
	x = 0
	y = 0
	alex = math.pow(x1 - x, 2) + math.pow(y1 - y, 2)
	bob = math.pow(x2 - x, 2) + math.pow(y2 - y, 2)
	a = math.sqrt(alex)
	b = math.sqrt(bob)
	if a > b:
		print('ALEX')
	elif b > a:
		print('BOB')
	else:
		print('EQUAL')


a = int(input())
for i in range(a):
	b = [int(x) for x in input().split()]
	c = [(b[0] ** 2 + b[1] ** 2) ** (1 / 2), (b[2] ** 2 + b[3] ** 2) ** (1 / 2)]
	if c[0] == c[1]:
		print('EQUAL')
	elif c[0] > c[1]:
		print('ALEX')
	elif c[0] < c[1]:
		print('BOB')


t = int(input())
for i in range(t):
	(X1, Y1, X2, Y2) = map(int, input().split())
	Alex_distance = X1 * X1 + Y1 * Y1
	Bob_distance = X2 * X2 + Y2 * Y2
	if Alex_distance == Bob_distance:
		print('EQUAL')
	elif Alex_distance > Bob_distance:
		print('ALEX')
	else:
		print('BOB')


for i in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	c = x1 ** 2 + y1 ** 2
	d = x2 ** 2 + y2 ** 2
	if c ** (1 / 2) > d ** (1 / 2):
		print('ALEX')
	elif c ** (1 / 2) < d ** (1 / 2):
		print('BOB')
	else:
		print('EQUAL')