a,b,c,d=list(map(int,input().split()))

print((max(0,min(b,d)-max(a,c))))
a, b, c, d = input().split(' ');time= int(min(int(b), int(d))) - int(max(int(a), int(c)));print((time if time>0 else 0))
a, b, c, d = list(map(int, input().split()))
print((max(0, min(b, d) - max(a, c))))

a, b, c, d = input().split(" ")
time = int(min(int(b), int(d))) - int(max(int(a), int(c)))
print((time if time > 0 else 0))

-a, b, c, d = list(map(int, input().split())) -print((max(0, min(b, d) - max(a, c)))) +a, b, c, d = input().split(" ") +time = int(min(int(b), int(d))) - int(max(int(a), int(c))) +print((time if time > 0 else 0))