Read problems statements in Mandarin Chinese and Russian as well. 

Professor Snape has lots of potions. Bottles containing all types of potions are stacked on shelves which cover the entire wall from floor to ceiling. Professor Snape has broken his bones several times while climbing the top shelf for retrieving a potion. He decided to get a ladder for him. But he has no time to visit Diagon Alley. So he instructed Ron Weasley to make a ladder for him. Professor Snape specifically wants a step ladder which looks like an inverted 'V' from side view.

Professor just mentioned two things before vanishing-
B - separation between left side (LS) and right side (RS) on the ground
LS - the length of left sideWhat should be the length of RS? At one extreme LS can be vertical and at other RS can be vertical. Ron is angry and confused. Since Harry is busy battling Voldemort, its your duty to help him find the minimum and maximum length of RS.

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

First line contains single integer T, the number of test cases. Then T lines follow each containing 2 integers - B and LS.

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

Output T lines, each containing minimum value of RS and maximum value of RS, separated by space. The answer (RS) will be considered correct if it has relative and absolute error less than 10^{-2}.

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

1 ≤ T ≤ 1000
1 ≤ B < LS ≤ 1000 

----- Sample Input 1 ------ 
3
4 5
10 12
10 20
----- Sample Output 1 ------ 
3.0 6.40312
6.63325 15.6205
17.3205 22.3607

Source: codechef | Difficulty: EASY
Tags: Geometry

Implementation


Solutions:
import math
for i in range(int(input())):
	(l, r) = map(int, input().split())
	print(round(math.sqrt(r ** 2 - l ** 2), 4), round(math.sqrt(l ** 2 + r ** 2), 4))


t = int(input())
for i in range(t):
	(b, ls) = map(int, input().split())
	print(round((ls * ls - b * b) ** 0.5, 4), round((b * b + ls * ls) ** 0.5, 4))


import math
t = int(input())
for i in range(t):
	(b, ls) = map(int, input().split())
	print(round(math.sqrt(ls * ls - b * b), 4), ' ', round(math.sqrt(ls * ls + b * b), 4))


import math
n = int(input())
for i in range(n):
	(ls, b) = list(map(int, input().split()))
	print(round((b ** 2 - ls ** 2) ** 0.5, 4), end=' ')
	print(round((b ** 2 + ls ** 2) ** 0.5, 4))


import math
for i in range(int(input())):
	(x, y) = map(float, input().split())
	z1 = (y * y - x * x) ** 0.5
	z2 = (x * x + y * y) ** 0.5
	print(round(z1, 4), round(z2, 4))


import math
for _ in range(int(input())):
	(b, ls) = map(int, input().split())
	c = math.pow(b, 2)
	d = math.pow(ls, 2)
	rsM = math.sqrt(c + d)
	rsm = math.sqrt(abs(c - d))
	print(round(rsm, 4), round(rsM, 4))


import math
for t in range(int(input())):
	(b, ls) = map(int, input().split())
	c = math.pow(b, 2)
	d = math.pow(ls, 2)
	q = c + d
	w = abs(c - d)
	r = math.sqrt(q)
	s = math.sqrt(w)
	print(round(s, 4), round(r, 4))


import math
n = int(input())
for i in range(1, n + 1):
	(a, b) = map(int, input().split())
	c = math.pow(a, 2)
	d = math.pow(b, 2)
	q = c + d
	w = abs(c - d)
	x = math.sqrt(q)
	y = math.sqrt(w)
	print(round(y, 4), round(x, 4))