H,W,M = map(int, input().split())
mx=[0] * W
my=[0] * H
bs ={}
mxx = 0
myy = 0
for i in range(M):
    y,x = map(int, input().split())
    mx[x-1] += 1
    my[y-1] += 1
    mxx = max(mx[x-1], mxx)
    myy = max(my[y-1], myy)
    if y-1 in bs:
        bs[y-1].add(x-1)
    else:
        bs[y-1] = set([x-1])

vx = []
vy = []
for i,x in enumerate(mx):
    if x == mxx:
        vx.append(i)
for i,y in enumerate(my):
    if y == myy:
        vy.append(i)

a = 1

for i in vx:
    for j in vy:
        if i not in bs[j]:
            a = 0
            break
    else:
        continue
    break

ans = mxx + myy - a
print(ans) H,W,M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M mx=[0] * W mx [0] * W [0] 0 W my=[0] * H my [0] * H [0] 0 H bs ={} bs {} mxx = 0 mxx 0 myy = 0 myy 0 for i in range(M):
    y,x = map(int, input().split())
    mx[x-1] += 1
    my[y-1] += 1
    mxx = max(mx[x-1], mxx)
    myy = max(my[y-1], myy)
    if y-1 in bs:
        bs[y-1].add(x-1)
    else:
        bs[y-1] = set([x-1]) i range(M) range M y,x = map(int, input().split()) y map(int, input().split()) map int input().split() ().split () input split x mx[x-1] += 1 mx[x-1] mx x-1 x 1 1 my[y-1] += 1 my[y-1] my y-1 y 1 1 mxx = max(mx[x-1], mxx) mxx max(mx[x-1], mxx) max mx[x-1] mx x-1 x 1 mxx myy = max(my[y-1], myy) myy max(my[y-1], myy) max my[y-1] my y-1 y 1 myy if y-1 in bs:
        bs[y-1].add(x-1)
    else:
        bs[y-1] = set([x-1]) y-1 in bs y-1 y 1 bs bs[y-1].add(x-1) [y-1].add [y-1] bs y-1 y 1 add x-1 x 1 bs[y-1] = set([x-1]) bs[y-1] bs y-1 y 1 set([x-1]) set [x-1] x-1 x 1 vx = [] vx [] vy = [] vy [] for i,x in enumerate(mx):
    if x == mxx:
        vx.append(i) i x enumerate(mx) enumerate mx if x == mxx:
        vx.append(i) x == mxx x mxx vx.append(i) vx.append vx append i for i,y in enumerate(my):
    if y == myy:
        vy.append(i) i y enumerate(my) enumerate my if y == myy:
        vy.append(i) y == myy y myy vy.append(i) vy.append vy append i a = 1 a 1 for i in vx:
    for j in vy:
        if i not in bs[j]:
            a = 0
            break
    else:
        continue
    break i vx for j in vy:
        if i not in bs[j]:
            a = 0
            break
    else:
        continue
     j vy if i not in bs[j]:
            a = 0
            break
     i not in bs[j] i bs[j] bs j a = 0 a 0 break continue break ans = mxx + myy - a ans mxx + myy - a mxx + myy mxx myy a print(ans) print ans y,x = map(int, input().split()) map(int, input().split()) y x = map(int, input().split()) map(int, input().split()) x W,M = map(int, input().split()) map(int, input().split()) W myy = 0 0 myy my=[0] * H [0] * H my mxx = 0 0 mxx H,W,M = map(int, input().split()) map(int, input().split()) H ans = mxx + myy - a mxx + myy - a ans mxx = max(mx[x-1], mxx) max(mx[x-1], mxx) mxx vy = [] [] vy mx=[0] * W [0] * W mx a = 1 1 a bs ={} {} bs M = map(int, input().split()) map(int, input().split()) M myy = max(my[y-1], myy) max(my[y-1], myy) myy vx = [] [] vx a = 0 0 a
H,W,M = map(int, input().split())
mx=[0] * W
my=[0] * H
bs ={}
mxx = 0
myy = 0
for i in range(M):
    y,x = map(int, input().split())
    mx[x-1] += 1
    my[y-1] += 1
    mxx = max(mx[x-1], mxx)
    myy = max(my[y-1], myy)
    if y-1 in bs:
        bs[y-1].add(x-1)
    else:
        bs[y-1] = set([x-1])

vx = []
vy = []
for i,x in enumerate(mx):
    if x == mxx:
        vx.append(i)
for i,y in enumerate(my):
    if y == myy:
        vy.append(i)

a = 1

for i in vx:
    for j in vy:
        if i not in bs[j]:
            a = 0
            break
    else:
        continue
    break

ans = mxx + myy - a
print(ans)
