import sys

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

s, g = 0, 0

if A <= C:

    s = C

    if B < s:

        print((0))

        sys.exit()

else:

    s = A

    if D < s:

        print((0))

        sys.exit()



if B <= D:

    g = B

else:

    g = D



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

if B <= C or D <= A:

    print((0))

elif A <= C:

    if B <= D:

        print((B - C))

    else:

        print((D - C))

else:

    if D <= B:

        print((D - A))

    else:

        print((B - A))

import sys

A, B, C, D = list(map(int, input().split()))
s, g = 0, 0
if A <= C:
    s = C
    if B < s:
        print((0))
        sys.exit()
else:
    s = A
    if D < s:
        print((0))
        sys.exit()
if B <= D:
    g = B
else:
    g = D
print((g - s))

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

-import sys - -s, g = 0, 0 -if A <= C: -    s = C -    if B < s: -        print((0)) -        sys.exit() +if B <= C or D <= A: +    print((0)) +elif A <= C: +    if B <= D: +        print((B - C)) +    else: +        print((D - C)) -    s = A -    if D < s: -        print((0)) -        sys.exit() -if B <= D: -    g = B -else: -    g = D -print((g - s)) +    if D <= B: +        print((D - A)) +    else: +        print((B - A))