H, W, M = map(int, input().split())
hws = [list(map(lambda x :int(x)-1, input().split())) for _ in range(M)]

booms = [set() for _ in range(H)]

yoko = [0 for _ in range(W)]
tate = [0 for _ in range(H)]

for hw in hws:
    tate[hw[0]] += 1
    yoko[hw[1]] += 1
    booms[hw[0]].add(hw[1])
    
max_tate = max(tate)
max_yoko = max(yoko)


tate_candidates = []
yoko_candidates = []

for i in range(H):
    if tate[i] == max_tate:
        tate_candidates.append(i)
        
for i in range(W):
    if yoko[i] == max_yoko:
        yoko_candidates.append(i)

exist = 0
for tate_candidate in tate_candidates:
    for yoko_candidate in yoko_candidates:
        if yoko_candidate not in booms[tate_candidate]:
            exist = 1
            break
    else:
        continue
    break
print(max_tate + max_yoko + (exist-1)) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M list(map(lambda x :int(x)-1, input().split())) for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) list(map(lambda x :int(x)-1, input().split())) list map(lambda x :int(x)-1, input().split()) map lambda x :int(x)-1 int(x)-1 int(x) int x 1 x input().split() ().split () input split hws = [list(map(lambda x :int(x)-1, input().split())) for _ in range(M)] hws [list(map(lambda x :int(x)-1, input().split())) for _ in range(M)] set() for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) set() set booms = [set() for _ in range(H)] booms [set() for _ in range(H)] 0 for _ in range(W) for _ in range(W) _ range(W) range W for _ in range(W) 0 yoko = [0 for _ in range(W)] yoko [0 for _ in range(W)] 0 for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) 0 tate = [0 for _ in range(H)] tate [0 for _ in range(H)] for hw in hws:
    tate[hw[0]] += 1
    yoko[hw[1]] += 1
    booms[hw[0]].add(hw[1])
     hw hws tate[hw[0]] += 1 tate[hw[0]] tate hw[0] hw 0 1 yoko[hw[1]] += 1 yoko[hw[1]] yoko hw[1] hw 1 1 booms[hw[0]].add(hw[1]) [hw[0]].add [hw[0]] booms hw[0] hw 0 add hw[1] hw 1 max_tate = max(tate) max_tate max(tate) max tate max_yoko = max(yoko) max_yoko max(yoko) max yoko tate_candidates = [] tate_candidates [] yoko_candidates = [] yoko_candidates [] for i in range(H):
    if tate[i] == max_tate:
        tate_candidates.append(i)
         i range(H) range H if tate[i] == max_tate:
        tate_candidates.append(i)
         tate[i] == max_tate tate[i] tate i max_tate tate_candidates.append(i) tate_candidates.append tate_candidates append i for i in range(W):
    if yoko[i] == max_yoko:
        yoko_candidates.append(i) i range(W) range W if yoko[i] == max_yoko:
        yoko_candidates.append(i) yoko[i] == max_yoko yoko[i] yoko i max_yoko yoko_candidates.append(i) yoko_candidates.append yoko_candidates append i exist = 0 exist 0 for tate_candidate in tate_candidates:
    for yoko_candidate in yoko_candidates:
        if yoko_candidate not in booms[tate_candidate]:
            exist = 1
            break
    else:
        continue
    break tate_candidate tate_candidates for yoko_candidate in yoko_candidates:
        if yoko_candidate not in booms[tate_candidate]:
            exist = 1
            break
    else:
        continue
     yoko_candidate yoko_candidates if yoko_candidate not in booms[tate_candidate]:
            exist = 1
            break
     yoko_candidate not in booms[tate_candidate] yoko_candidate booms[tate_candidate] booms tate_candidate exist = 1 exist 1 break continue break print(max_tate + max_yoko + (exist-1)) print max_tate + max_yoko + (exist-1) max_tate + max_yoko max_tate max_yoko exist-1 exist 1 W, M = map(int, input().split()) map(int, input().split()) W max_tate = max(tate) max(tate) max_tate exist = 1 1 exist booms = [set() for _ in range(H)] [set() for _ in range(H)] booms H, W, M = map(int, input().split()) map(int, input().split()) H M = map(int, input().split()) map(int, input().split()) M hws = [list(map(lambda x :int(x)-1, input().split())) for _ in range(M)] [list(map(lambda x :int(x)-1, input().split())) for _ in range(M)] hws tate = [0 for _ in range(H)] [0 for _ in range(H)] tate max_yoko = max(yoko) max(yoko) max_yoko yoko_candidates = [] [] yoko_candidates yoko = [0 for _ in range(W)] [0 for _ in range(W)] yoko tate_candidates = [] [] tate_candidates exist = 0 0 exist
H, W, M = map(int, input().split())
hws = [list(map(lambda x :int(x)-1, input().split())) for _ in range(M)]

booms = [set() for _ in range(H)]

yoko = [0 for _ in range(W)]
tate = [0 for _ in range(H)]

for hw in hws:
    tate[hw[0]] += 1
    yoko[hw[1]] += 1
    booms[hw[0]].add(hw[1])
    
max_tate = max(tate)
max_yoko = max(yoko)


tate_candidates = []
yoko_candidates = []

for i in range(H):
    if tate[i] == max_tate:
        tate_candidates.append(i)
        
for i in range(W):
    if yoko[i] == max_yoko:
        yoko_candidates.append(i)

exist = 0
for tate_candidate in tate_candidates:
    for yoko_candidate in yoko_candidates:
        if yoko_candidate not in booms[tate_candidate]:
            exist = 1
            break
    else:
        continue
    break
print(max_tate + max_yoko + (exist-1))
