n = int(eval(input()))

A = [0]*n

B = [0]*n

for i in range(n):

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

    A[i] = a

    B[i] = b



A.sort()

B.sort()



if n%2 == 1:

    ans = B[n//2]-A[n//2]+1

else:

    ans = B[n//2-1]+B[n//2]-(A[n//2-1]+A[n//2])+1

print(ans)

n = int(eval(input()))

A = []

B = []

for i in range(n):

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

    A.append(a)

    B.append(b)



A.sort()

B.sort()

if n%2 == 1:

    ans = B[n//2]-A[n//2]+1

else:

    x = A[n//2-1]+A[n//2]

    y = B[n//2-1]+B[n//2]

    ans = y-x+1

print(ans)

n = int(eval(input()))
A = [0] * n
B = [0] * n
for i in range(n):
    a, b = list(map(int, input().split()))
    A[i] = a
    B[i] = b
A.sort()
B.sort()
if n % 2 == 1:
    ans = B[n // 2] - A[n // 2] + 1
else:
    ans = B[n // 2 - 1] + B[n // 2] - (A[n // 2 - 1] + A[n // 2]) + 1
print(ans)

n = int(eval(input()))
A = []
B = []
for i in range(n):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
A.sort()
B.sort()
if n % 2 == 1:
    ans = B[n // 2] - A[n // 2] + 1
else:
    x = A[n // 2 - 1] + A[n // 2]
    y = B[n // 2 - 1] + B[n // 2]
    ans = y - x + 1
print(ans)

-A = [0] * n -B = [0] * n +A = [] +B = [] -    A[i] = a -    B[i] = b +    A.append(a) +    B.append(b) -    ans = B[n // 2 - 1] + B[n // 2] - (A[n // 2 - 1] + A[n // 2]) + 1 +    x = A[n // 2 - 1] + A[n // 2] +    y = B[n // 2 - 1] + B[n // 2] +    ans = y - x + 1