h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for i in range(m)]
hb = [0] * h
wb = [0] * w

for i in range(m):
    hb[hw[i][0]-1] += 1
    wb[hw[i][1]-1] += 1

max_h = max(hb)
max_w = max(wb)
ans = max_h + max_w
count = hb.count(max_h) * wb.count(max_w)
for i in range(m):
    if hb[hw[i][0]-1] == max_h and wb[hw[i][1]-1] == max_w:
        count -= 1
if count <= 0:
    ans -= 1
print(ans) h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m list(map(int,input().split())) for i in range(m) for i in range(m) i range(m) range m for i in range(m) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split hw = [list(map(int,input().split())) for i in range(m)] hw [list(map(int,input().split())) for i in range(m)] hb = [0] * h hb [0] * h [0] 0 h wb = [0] * w wb [0] * w [0] 0 w for i in range(m):
    hb[hw[i][0]-1] += 1
    wb[hw[i][1]-1] += 1 i range(m) range m hb[hw[i][0]-1] += 1 hb[hw[i][0]-1] hb hw[i][0]-1 hw[i][0] [i] hw i 0 1 1 wb[hw[i][1]-1] += 1 wb[hw[i][1]-1] wb hw[i][1]-1 hw[i][1] [i] hw i 1 1 1 max_h = max(hb) max_h max(hb) max hb max_w = max(wb) max_w max(wb) max wb ans = max_h + max_w ans max_h + max_w max_h max_w count = hb.count(max_h) * wb.count(max_w) count hb.count(max_h) * wb.count(max_w) hb.count(max_h) hb.count hb count max_h wb.count(max_w) wb.count wb count max_w for i in range(m):
    if hb[hw[i][0]-1] == max_h and wb[hw[i][1]-1] == max_w:
        count -= 1 i range(m) range m if hb[hw[i][0]-1] == max_h and wb[hw[i][1]-1] == max_w:
        count -= 1 hb[hw[i][0]-1] == max_h and wb[hw[i][1]-1] == max_w hb[hw[i][0]-1] == max_h hb[hw[i][0]-1] hb hw[i][0]-1 hw[i][0] [i] hw i 0 1 max_h wb[hw[i][1]-1] == max_w wb[hw[i][1]-1] wb hw[i][1]-1 hw[i][1] [i] hw i 1 1 max_w count -= 1 count 1 if count <= 0:
    ans -= 1 count <= 0 count 0 ans -= 1 ans 1 print(ans) print ans hb = [0] * h [0] * h hb max_w = max(wb) max(wb) max_w h,w,m = map(int,input().split()) map(int,input().split()) h hw = [list(map(int,input().split())) for i in range(m)] [list(map(int,input().split())) for i in range(m)] hw w,m = map(int,input().split()) map(int,input().split()) w m = map(int,input().split()) map(int,input().split()) m wb = [0] * w [0] * w wb max_h = max(hb) max(hb) max_h ans = max_h + max_w max_h + max_w ans count = hb.count(max_h) * wb.count(max_w) hb.count(max_h) * wb.count(max_w) count count -= 1 1 count ans -= 1 1 ans
h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for i in range(m)]
hb = [0] * h
wb = [0] * w

for i in range(m):
    hb[hw[i][0]-1] += 1
    wb[hw[i][1]-1] += 1

max_h = max(hb)
max_w = max(wb)
ans = max_h + max_w
count = hb.count(max_h) * wb.count(max_w)
for i in range(m):
    if hb[hw[i][0]-1] == max_h and wb[hw[i][1]-1] == max_w:
        count -= 1
if count <= 0:
    ans -= 1
print(ans)