min_li, max_li = [], []

n = int(eval(input()))

for _ in range(n):

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

    min_li.append((a, b))

    max_li.append((a, b))

min_li.sort()

max_li.sort(key=lambda x: x[1], reverse=True)

if n % 2 == 1:

    mid = n // 2

    blue_min = min_li[mid][0]

    blue_max = min(min_li[mid:], key=lambda x: x[1])[1]

    red_max = max_li[mid][1]

    red_min = max(max_li[mid:])[0]

else:

    mid_1 = n // 2 - 1

    mid_2 = n // 2

    min_li_half = sorted(min_li[mid_1:], key=lambda x: x[1])

    blue_min = min_li[mid_1][0] + min_li[mid_2][0]

    blue_max = min_li_half[0][1] + min_li_half[1][1]

    max_li_half = sorted(max_li[mid_1:], reverse=True)

    red_max = max_li[mid_1][1] + max_li[mid_2][1]

    red_min = max_li_half[0][0] + max_li_half[1][0]



ans = red_max - blue_min + 1



print(ans)
lower, upper = [], []

n = int(eval(input()))

for _ in range(n):

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

    lower.append(a)

    upper.append(b)

lower.sort()

upper.sort(reverse=True)

if n % 2 == 1:

    mid = n // 2

    median_min = lower[mid]

    median_max = upper[mid]

else:

    mid = n // 2 - 1

    median_min = lower[mid] + lower[mid + 1]

    median_max = upper[mid] + upper[mid + 1]

print((median_max - median_min + 1))
min_li, max_li = [], []
n = int(eval(input()))
for _ in range(n):
    a, b = list(map(int, input().split()))
    min_li.append((a, b))
    max_li.append((a, b))
min_li.sort()
max_li.sort(key=lambda x: x[1], reverse=True)
if n % 2 == 1:
    mid = n // 2
    blue_min = min_li[mid][0]
    blue_max = min(min_li[mid:], key=lambda x: x[1])[1]
    red_max = max_li[mid][1]
    red_min = max(max_li[mid:])[0]
else:
    mid_1 = n // 2 - 1
    mid_2 = n // 2
    min_li_half = sorted(min_li[mid_1:], key=lambda x: x[1])
    blue_min = min_li[mid_1][0] + min_li[mid_2][0]
    blue_max = min_li_half[0][1] + min_li_half[1][1]
    max_li_half = sorted(max_li[mid_1:], reverse=True)
    red_max = max_li[mid_1][1] + max_li[mid_2][1]
    red_min = max_li_half[0][0] + max_li_half[1][0]
ans = red_max - blue_min + 1
print(ans)

lower, upper = [], []
n = int(eval(input()))
for _ in range(n):
    a, b = list(map(int, input().split()))
    lower.append(a)
    upper.append(b)
lower.sort()
upper.sort(reverse=True)
if n % 2 == 1:
    mid = n // 2
    median_min = lower[mid]
    median_max = upper[mid]
else:
    mid = n // 2 - 1
    median_min = lower[mid] + lower[mid + 1]
    median_max = upper[mid] + upper[mid + 1]
print((median_max - median_min + 1))

-min_li, max_li = [], [] +lower, upper = [], [] -    min_li.append((a, b)) -    max_li.append((a, b)) -min_li.sort() -max_li.sort(key=lambda x: x[1], reverse=True) +    lower.append(a) +    upper.append(b) +lower.sort() +upper.sort(reverse=True) -    blue_min = min_li[mid][0] -    blue_max = min(min_li[mid:], key=lambda x: x[1])[1] -    red_max = max_li[mid][1] -    red_min = max(max_li[mid:])[0] +    median_min = lower[mid] +    median_max = upper[mid] -    mid_1 = n // 2 - 1 -    mid_2 = n // 2 -    min_li_half = sorted(min_li[mid_1:], key=lambda x: x[1]) -    blue_min = min_li[mid_1][0] + min_li[mid_2][0] -    blue_max = min_li_half[0][1] + min_li_half[1][1] -    max_li_half = sorted(max_li[mid_1:], reverse=True) -    red_max = max_li[mid_1][1] + max_li[mid_2][1] -    red_min = max_li_half[0][0] + max_li_half[1][0] -ans = red_max - blue_min + 1 -print(ans) +    mid = n // 2 - 1 +    median_min = lower[mid] + lower[mid + 1] +    median_max = upper[mid] + upper[mid + 1] +print((median_max - median_min + 1))