n = int(input())
for i in range(n):
a = int(input())
if a<32768:
xmin = a%4
xmax = a%2
if xmin==0 and xmax==0:
print("{:.0f} {:.0f}".format(a/4,a/2))
else:
print(0,0)
else:
print(0, 0)