N = int(eval(input()))

AB = sorted([[int(_) for _ in input().split()] for _ in range(N)],

            key=lambda x: x[1],

            reverse=True)

CD = sorted([[int(_) for _ in input().split()] for _ in range(N)])

 

for i in range(N):

    for j in range(len(AB)):

        if AB[j][0] < CD[i][0] and AB[j][1] < CD[i][1]:

            del AB[j]

            break

print((N - len(AB)))
N = int(eval(input()))

AB = sorted([[int(_) for _ in input().split()] for _ in range(N)],

            key=lambda x: x[1],

            reverse=True)

CD = sorted([[int(_) for _ in input().split()] for _ in range(N)])

 

count = 0

for i in range(N):

    for j in range(len(AB)):

        if AB[j][0] < CD[i][0] and AB[j][1] < CD[i][1]:

            del AB[j]

            count += 1

            break

print(count)
N = int(eval(input()))
AB = sorted(
    [[int(_) for _ in input().split()] for _ in range(N)],
    key=lambda x: x[1],
    reverse=True,
)
CD = sorted([[int(_) for _ in input().split()] for _ in range(N)])
for i in range(N):
    for j in range(len(AB)):
        if AB[j][0] < CD[i][0] and AB[j][1] < CD[i][1]:
            del AB[j]
            break
print((N - len(AB)))

N = int(eval(input()))
AB = sorted(
    [[int(_) for _ in input().split()] for _ in range(N)],
    key=lambda x: x[1],
    reverse=True,
)
CD = sorted([[int(_) for _ in input().split()] for _ in range(N)])
count = 0
for i in range(N):
    for j in range(len(AB)):
        if AB[j][0] < CD[i][0] and AB[j][1] < CD[i][1]:
            del AB[j]
            count += 1
            break
print(count)

+count = 0 +            count += 1 -print((N - len(AB))) +print(count)