h, w, m = map(int, input().split())
b = []
for i in range(m):
    hh, ww = map(int,input().split())
    hh -= 1
    ww -= 1
    b.append([hh, ww])
    
cnth = [0] * h
cntw = [0] * w
          
for i in range(m):
    hh, ww = b[i][0], b[i][1]
    cnth[hh] += 1
    cntw[ww] += 1
    
mh = max(cnth)
mw = max(cntw)

cnt_mh = 0
for i in range(h):
    if cnth[i] == mh:
        cnt_mh += 1
cnt_mw = 0
for i in range(w):
    if cntw[i] == mw:
        cnt_mw += 1

cnt_m = 0
for i in range(m):
    hh, ww = b[i][0], b[i][1]
    if cnth[hh] == mh and cntw[ww] == mw:
        cnt_m += 1
print(mh+mw) if cnt_mh*cnt_mw > cnt_m else print(mh+mw-1) h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m b = [] b [] for i in range(m):
    hh, ww = map(int,input().split())
    hh -= 1
    ww -= 1
    b.append([hh, ww])
     i range(m) range m hh, ww = map(int,input().split()) hh map(int,input().split()) map int input().split() ().split () input split ww hh -= 1 hh 1 ww -= 1 ww 1 b.append([hh, ww]) b.append b append [hh, ww] hh ww cnth = [0] * h cnth [0] * h [0] 0 h cntw = [0] * w cntw [0] * w [0] 0 w for i in range(m):
    hh, ww = b[i][0], b[i][1]
    cnth[hh] += 1
    cntw[ww] += 1
     i range(m) range m hh, ww = b[i][0], b[i][1] hh b[i][0] [i] b i 0 ww b[i][1] [i] b i 1 cnth[hh] += 1 cnth[hh] cnth hh 1 cntw[ww] += 1 cntw[ww] cntw ww 1 mh = max(cnth) mh max(cnth) max cnth mw = max(cntw) mw max(cntw) max cntw cnt_mh = 0 cnt_mh 0 for i in range(h):
    if cnth[i] == mh:
        cnt_mh += 1 i range(h) range h if cnth[i] == mh:
        cnt_mh += 1 cnth[i] == mh cnth[i] cnth i mh cnt_mh += 1 cnt_mh 1 cnt_mw = 0 cnt_mw 0 for i in range(w):
    if cntw[i] == mw:
        cnt_mw += 1 i range(w) range w if cntw[i] == mw:
        cnt_mw += 1 cntw[i] == mw cntw[i] cntw i mw cnt_mw += 1 cnt_mw 1 cnt_m = 0 cnt_m 0 for i in range(m):
    hh, ww = b[i][0], b[i][1]
    if cnth[hh] == mh and cntw[ww] == mw:
        cnt_m += 1 i range(m) range m hh, ww = b[i][0], b[i][1] hh b[i][0] [i] b i 0 ww b[i][1] [i] b i 1 if cnth[hh] == mh and cntw[ww] == mw:
        cnt_m += 1 cnth[hh] == mh and cntw[ww] == mw cnth[hh] == mh cnth[hh] cnth hh mh cntw[ww] == mw cntw[ww] cntw ww mw cnt_m += 1 cnt_m 1 print(mh+mw) if cnt_mh*cnt_mw > cnt_m else print(mh+mw-1) cnt_mh*cnt_mw > cnt_m cnt_mh*cnt_mw cnt_mh cnt_mw cnt_m print(mh+mw) print mh+mw mh mw print(mh+mw-1) print mh+mw-1 mh+mw mh mw 1 cnt_mh += 1 1 cnt_mh ww = b[i][0], b[i][1] b[i][1] ww hh, ww = b[i][0], b[i][1] b[i][0] hh ww = b[i][0], b[i][1] b[i][1] ww m = map(int, input().split()) map(int, input().split()) m cntw = [0] * w [0] * w cntw h, w, m = map(int, input().split()) map(int, input().split()) h hh, ww = map(int,input().split()) map(int,input().split()) hh cnt_mw = 0 0 cnt_mw cnt_m += 1 1 cnt_m cnt_m = 0 0 cnt_m cnth = [0] * h [0] * h cnth ww -= 1 1 ww ww = map(int,input().split()) map(int,input().split()) ww mw = max(cntw) max(cntw) mw mh = max(cnth) max(cnth) mh b = [] [] b cnt_mw += 1 1 cnt_mw hh -= 1 1 hh w, m = map(int, input().split()) map(int, input().split()) w cnt_mh = 0 0 cnt_mh hh, ww = b[i][0], b[i][1] b[i][0] hh
h, w, m = map(int, input().split())
b = []
for i in range(m):
    hh, ww = map(int,input().split())
    hh -= 1
    ww -= 1
    b.append([hh, ww])
    
cnth = [0] * h
cntw = [0] * w
          
for i in range(m):
    hh, ww = b[i][0], b[i][1]
    cnth[hh] += 1
    cntw[ww] += 1
    
mh = max(cnth)
mw = max(cntw)

cnt_mh = 0
for i in range(h):
    if cnth[i] == mh:
        cnt_mh += 1
cnt_mw = 0
for i in range(w):
    if cntw[i] == mw:
        cnt_mw += 1

cnt_m = 0
for i in range(m):
    hh, ww = b[i][0], b[i][1]
    if cnth[hh] == mh and cntw[ww] == mw:
        cnt_m += 1
print(mh+mw) if cnt_mh*cnt_mw > cnt_m else print(mh+mw-1)
