A, B, C, D = list(map(int, input().split()))

if B <= C or D <= A:

    print((0))

else:

    print((min(B-A, D-A, B-C, D-C)))
A, B, C, D = list(map(int, input().split()))

print((max(0, min(B, D)-max(A, C))))
A, B, C, D = list(map(int, input().split()))
if B <= C or D <= A:
    print((0))
else:
    print((min(B - A, D - A, B - C, D - C)))

A, B, C, D = list(map(int, input().split()))
print((max(0, min(B, D) - max(A, C))))

-if B <= C or D <= A: -    print((0)) -else: -    print((min(B - A, D - A, B - C, D - C))) +print((max(0, min(B, D) - max(A, C))))