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

if A <= C:

    x = [A, B]

    y = [C, D]

else:

    y = [A, B]

    x = [C, D]

if x[1] <= y[1]:

    d = x[1] - y[0]

else:

    d = y[1] - y[0]

if d < 0:

    d = 0

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

def overlap(a, b):

    if max(a[0], b[0]) > min(a[1], b[1]):

        return [0, 0]

    return [max(a[0], b[0]), min(a[1], b[1])]

ans = overlap([a, b], [c, d])

print((ans[1] - ans[0]))
A, B, C, D = list(map(int, input().split()))
if A <= C:
    x = [A, B]
    y = [C, D]
else:
    y = [A, B]
    x = [C, D]
if x[1] <= y[1]:
    d = x[1] - y[0]
else:
    d = y[1] - y[0]
if d < 0:
    d = 0
print(d)

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


def overlap(a, b):
    if max(a[0], b[0]) > min(a[1], b[1]):
        return [0, 0]
    return [max(a[0], b[0]), min(a[1], b[1])]


ans = overlap([a, b], [c, d])
print((ans[1] - ans[0]))

-A, B, C, D = list(map(int, input().split())) -if A <= C: -    x = [A, B] -    y = [C, D] -else: -    y = [A, B] -    x = [C, D] -if x[1] <= y[1]: -    d = x[1] - y[0] -else: -    d = y[1] - y[0] -if d < 0: -    d = 0 -print(d) +a, b, c, d = list(map(int, input().split())) + + +def overlap(a, b): +    if max(a[0], b[0]) > min(a[1], b[1]): +        return [0, 0] +    return [max(a[0], b[0]), min(a[1], b[1])] + + +ans = overlap([a, b], [c, d]) +print((ans[1] - ans[0]))