Chef is now a corporate person. He has to attend office regularly. But chef does not want to go to office, rather he wants to stay home and discover different recipes and cook them. 
In the office where chef works, has two guards who count how many times a person enters into the office building. Though the duty of a guard is 24 hour in a day, but sometimes they fall asleep during their duty and could not track the entry of a person in the office building. But one better thing is that they never fall asleep at the same time. At least one of them remains awake and counts who enters into the office.
Now boss of Chef wants to calculate how many times Chef has entered into the building. He asked to the guard and they give him two integers A and B, count of first guard and second guard respectively.
Help the boss to count the minimum and maximum number of times Chef could have entered into the office building.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of the T test cases follows. 
Each test case consists of a line containing two space separated integers A and B.

-----Output-----
For each test case, output a single line containing two space separated integers, the minimum and maximum number of times Chef could have entered into the office building.

-----Constraints-----
- 1 ≤ T ≤ 100
- 0 ≤ A, B ≤ 1000000

-----Example-----
Input:
1
19 17

Output:
19 36

Difficulty: EASY
Tags: Constructive algorithms

Mathematics

Ad-hoc

Starter code:

Solutions:
for i in range(int(input())):
	(a, b) = map(int, input().split())
	p = max(a, b)
	print(p, a + b)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	print(max(a, b), max(a, b) + min(a, b))


for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		c = a
	else:
		c = b
	print(c, end=' ')
	print(a + b)


t = int(input())
for x in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		print(a, a + b)
	else:
		print(b, a + b)


for _ in range(int(input())):
	n = list(map(int, input().split()))
	print(max(n), n[0] + n[1])


N = int(input())
while N > 0:
	(a, b) = map(int, input().split())
	print(max(a, b), a + b)
	N = N - 1


T = int(input())
for _ in range(T):
	(A, B) = map(int, input().split())
	print(max(A, B), A + B)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(max(a, b), end=' ')
	print(a + b)


N = int(input())
for i in range(N):
	(a, b) = list(map(int, input().split()))
	if a > b:
		print(a, a + b)
	elif a < b:
		print(b, a + b)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(max(a, b), a + b)


a = int(input())
for i in range(0, a):
	(b, c) = map(int, input().split())
	if b > c:
		d = b
	elif c > b:
		d = c
	print(d, b + c)


v = int(input())
for i in range(0, v):
	s = list(map(int, input().split()))
	print(max(s), sum(s))


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	a = x if x == y else x + y
	print(max(x, y), a)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split(' ')))
	if a > b:
		print(a, a + b)
	else:
		print(b, a + b)


for _ in range(int(input())):
	(w, e) = map(int, input().split())
	print(max(w, e), end=' ')
	print(w + e)


for i in range(0, int(input())):
	(a, b) = map(int, input().split())
	print(max(a, b), end=' ')
	print(a + b)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	minimum = max(a, b)
	maximum = a + b
	print(minimum, maximum)


t = int(input())
for i in range(t):
	a = input()
	a = [int(i) for i in a.split()]
	print(max(a), a[0] + a[1])


for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a > b:
		print(a, end=' ')
	if b > a:
		print(b, end=' ')
	print(a + b)


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	print(max(a, b), a + b)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = max(a, b)
	y = a + b
	print(x, y)


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	print(max(a, b), a + b)


N = int(input())
for i in range(1, N + 1):
	A = list(map(int, input().split()))
	P1 = A[0]
	P2 = A[1]
	if P1 > P2:
		B = P1
	else:
		B = P2
	C = P1 + P2
	print(str(B) + ' ' + str(C))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		c = a + b
		print(f'{a} {c}')
	elif a < b:
		c = a + b
		print(f'{b} {c}')


for case in range(int(input())):
	x = list(map(int, input().split()))
	print(max(x), sum(x))


for t in range(int(input())):
	(x, y) = map(int, input().split())
	if y > x:
		(x, y) = (y, x)
	print(x, x + y)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	print(max(a, b), a + b)
	t -= 1


try:
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		min_ = max(a, b)
		max_ = a + b
		print(min_, max_)
except:
	pass


ep = int(input())
while ep > 0:
	(EP, PC) = map(int, input().split())
	total = EP + PC
	print(max(EP, PC), total)
	ep = ep - 1


t = int(input())
for c in range(t):
	(a, b) = map(int, input().split())
	k = list((a, b))
	print(max(k), a + b)


try:
	t = int(input())
	for i in range(0, t):
		(a, b) = map(int, input().split())
		if a > b:
			print(a, a + b)
		else:
			print(b, a + b)
except:
	pass


n = int(input())
for i in range(n):
	(g1, g2) = map(int, input().split())
	s = 0
	if g1 < g2:
		s = g2
	else:
		s = g1
	print(s, g1 + g2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = max(a, b)
	d = a + b
	print(c, d)


for _ in range(int(input())):
	(o, k) = map(int, input().split())
	print(max(o, k), o + k)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	min_count = max(a, b)
	max_count = a + b
	print(min_count, max_count)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(max(a, b), end=' ')
	print(a + b)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(max(a, b), a + b, sep=' ')


t = int(input())
for i in range(0, t):
	a = list(map(int, input().split()))
	print(max(a), sum(a))


for i in range(int(input())):
	(Z, P) = map(int, input().split())
	print(max(Z, P), Z + P)


n = int(input())
while n > 0:
	(a, b) = map(int, input().strip().split())
	print(max(a, b), a + b)
	n = n - 1


T = int(input())
for i in range(T):
	(A, B) = list(map(int, input().split()))
	print(max(A, B), A + B)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	print(max(x, y), x + y)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	r1 = max(a, b)
	r2 = a + b
	print(r1, r2)


n = int(input())
for _ in range(n):
	(A, B) = list(map(int, input().split()))
	print(max(A, B), A + B)


for _ in range(int(input())):
	(onci, mati) = map(int, input().split())
	print(max(onci, mati), onci + mati)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	s = max(a, b)
	k = a + b
	print(s, k)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(max(x, y), x + y)


T = int(input())
while T > 0:
	(m, n) = map(int, input().split())
	total = m + n
	print(max(m, n), total)
	T = T - 1


t = int(input())
i = 0
while i < t:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	Max = a + b
	if a > b:
		Min = a
	else:
		Min = b
	print(Min, Max)
	i += 1


for _ in range(int(input())):
	z = list(map(int, input().split()))
	print(int(max(z)), int(sum(z)))


N = int(input())
for i in range(N):
	(n1, n2) = map(int, input().split())
	sum = n1 + n2
	if n1 > n2:
		print(n1, sum)
	else:
		print(n2, sum)


X = int(input())
for i in range(X):
	(A, R) = map(int, input().split())
	print(max(A, R), ' ', A + R)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = max(a, b)
	s = a + b
	print(z, s)


x = int(input())
s = 0
for i in range(x):
	(a, b) = map(int, input().split(' '))
	if a > b:
		s = a
	else:
		s = b
	print(s, a + b)