h,w,m = map(int,input().split())

tate = [0]*(h+1)
yoko = [0]*(w+1)

basyo = []

for i in range(m):
    hh,ww = map(int,input().split())
    basyo.append((hh-1,ww-1))
    
    tate[hh-1] += 1
    yoko[ww-1] += 1
    
tt,yy = 0,0
x = max(tate)

for i in tate:
    if i == x:
        tt += 1
        
y = max(yoko)
for i in yoko:
    if i == y:
        yy += 1
        
ans = x+y
pl = tt * yy

cur = 0
for i,j in basyo:
    if tate[i] + yoko[j] == ans:
        cur += 1
        
if pl > cur:
    print(ans)
else:
    print(ans-1) h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m tate = [0]*(h+1) tate [0]*(h+1) [0] 0 h+1 h 1 yoko = [0]*(w+1) yoko [0]*(w+1) [0] 0 w+1 w 1 basyo = [] basyo [] for i in range(m):
    hh,ww = map(int,input().split())
    basyo.append((hh-1,ww-1))
    
    tate[hh-1] += 1
    yoko[ww-1] += 1
     i range(m) range m hh,ww = map(int,input().split()) hh map(int,input().split()) map int input().split() ().split () input split ww basyo.append((hh-1,ww-1)) basyo.append basyo append (hh-1,ww-1) hh-1 hh 1 ww-1 ww 1 tate[hh-1] += 1 tate[hh-1] tate hh-1 hh 1 1 yoko[ww-1] += 1 yoko[ww-1] yoko ww-1 ww 1 1 tt,yy = 0,0 tt 0 yy 0 x = max(tate) x max(tate) max tate for i in tate:
    if i == x:
        tt += 1
         i tate if i == x:
        tt += 1
         i == x i x tt += 1 tt 1 y = max(yoko) y max(yoko) max yoko for i in yoko:
    if i == y:
        yy += 1
         i yoko if i == y:
        yy += 1
         i == y i y yy += 1 yy 1 ans = x+y ans x+y x y pl = tt * yy pl tt * yy tt yy cur = 0 cur 0 for i,j in basyo:
    if tate[i] + yoko[j] == ans:
        cur += 1
         i j basyo if tate[i] + yoko[j] == ans:
        cur += 1
         tate[i] + yoko[j] == ans tate[i] + yoko[j] tate[i] tate i yoko[j] yoko j ans cur += 1 cur 1 if pl > cur:
    print(ans)
else:
    print(ans-1) pl > cur pl cur print(ans) print ans print(ans-1) print ans-1 ans 1 m = map(int,input().split()) map(int,input().split()) m hh,ww = map(int,input().split()) map(int,input().split()) hh basyo = [] [] basyo ww = map(int,input().split()) map(int,input().split()) ww h,w,m = map(int,input().split()) map(int,input().split()) h x = max(tate) max(tate) x cur = 0 0 cur tt,yy = 0,0 0 tt tt += 1 1 tt tate = [0]*(h+1) [0]*(h+1) tate cur += 1 1 cur w,m = map(int,input().split()) map(int,input().split()) w yy += 1 1 yy y = max(yoko) max(yoko) y ans = x+y x+y ans pl = tt * yy tt * yy pl yoko = [0]*(w+1) [0]*(w+1) yoko yy = 0,0 0 yy
h,w,m = map(int,input().split())

tate = [0]*(h+1)
yoko = [0]*(w+1)

basyo = []

for i in range(m):
    hh,ww = map(int,input().split())
    basyo.append((hh-1,ww-1))
    
    tate[hh-1] += 1
    yoko[ww-1] += 1
    
tt,yy = 0,0
x = max(tate)

for i in tate:
    if i == x:
        tt += 1
        
y = max(yoko)
for i in yoko:
    if i == y:
        yy += 1
        
ans = x+y
pl = tt * yy

cur = 0
for i,j in basyo:
    if tate[i] + yoko[j] == ans:
        cur += 1
        
if pl > cur:
    print(ans)
else:
    print(ans-1)