N = int(eval(input()))

R = [[int(i) for i in input().split()] for _ in range(N)]

B = [[int(i) for i in input().split()] for _ in range(N)]



R.sort()

B.sort()



count = 0

tmp = []

for bx, by in B:

    for rx, ry in R:

        if bx > rx and by > ry:

            tmp.append([rx, ry])

    if tmp != []:

        max_red = max(tmp, key=lambda r: r[1])

        count += 1

        R.remove(max_red)

        tmp = []

print(count)



N, *I = list(map(int, open(0).read().split()))

AB = list(zip(*[iter(I[:2 * N])] * 2))

CD = sorted(zip(*[iter(I[2 * N:])] * 2))



for c, d in CD:

    ma = max(((a, b) for a, b in AB if a < c and b < d), key=lambda x: x[1], default=None)

    if ma:

        AB.remove(ma)



print((N - len(AB)))
N = int(eval(input()))
R = [[int(i) for i in input().split()] for _ in range(N)]
B = [[int(i) for i in input().split()] for _ in range(N)]
R.sort()
B.sort()
count = 0
tmp = []
for bx, by in B:
    for rx, ry in R:
        if bx > rx and by > ry:
            tmp.append([rx, ry])
    if tmp != []:
        max_red = max(tmp, key=lambda r: r[1])
        count += 1
        R.remove(max_red)
        tmp = []
print(count)

N, *I = list(map(int, open(0).read().split()))
AB = list(zip(*[iter(I[: 2 * N])] * 2))
CD = sorted(zip(*[iter(I[2 * N :])] * 2))
for c, d in CD:
    ma = max(
        ((a, b) for a, b in AB if a < c and b < d), key=lambda x: x[1], default=None
    )
    if ma:
        AB.remove(ma)
print((N - len(AB)))

-N = int(eval(input())) -R = [[int(i) for i in input().split()] for _ in range(N)] -B = [[int(i) for i in input().split()] for _ in range(N)] -R.sort() -B.sort() -count = 0 -tmp = [] -for bx, by in B: -    for rx, ry in R: -        if bx > rx and by > ry: -            tmp.append([rx, ry]) -    if tmp != []: -        max_red = max(tmp, key=lambda r: r[1]) -        count += 1 -        R.remove(max_red) -        tmp = [] -print(count) +N, *I = list(map(int, open(0).read().split())) +AB = list(zip(*[iter(I[: 2 * N])] * 2)) +CD = sorted(zip(*[iter(I[2 * N :])] * 2)) +for c, d in CD: +    ma = max( +        ((a, b) for a, b in AB if a < c and b < d), key=lambda x: x[1], default=None +    ) +    if ma: +        AB.remove(ma) +print((N - len(AB)))