x=[int(_) for _ in input().split()]

if x[1]<=x[2] or x[3]<=x[0]:

    print((0))

else:

    print((min([x[1],x[3]])-max([x[0],x[2]])))

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

if b<c:

    print((0))

elif d<a:

    print((0))

else:

    print((min(b,d)-max(a,c)))

x = [int(_) for _ in input().split()]
if x[1] <= x[2] or x[3] <= x[0]:
    print((0))
else:
    print((min([x[1], x[3]]) - max([x[0], x[2]])))

a, b, c, d = list(map(int, input().split()))
if b < c:
    print((0))
elif d < a:
    print((0))
else:
    print((min(b, d) - max(a, c)))

-x = [int(_) for _ in input().split()] -if x[1] <= x[2] or x[3] <= x[0]: +a, b, c, d = list(map(int, input().split())) +if b < c: +    print((0)) +elif d < a: -    print((min([x[1], x[3]]) - max([x[0], x[2]]))) +    print((min(b, d) - max(a, c)))