#The solution in Python 3 is as follows:
t=10
i=0
while i<t:
a=int(input()) #No. of apples both have
b=int(input()) #No. of extra apples Klaudia has
c=(a-b)//2
print(b+c)
print(c)
i+=1
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!
t=10
i=0
while i<t:
a=int(input()) #No. of apples both have
b=int(input()) #No. of extra apples Klaudia has
c=(a-b)//2
print(b+c)
print(c)
i+=1
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!