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

r=[0]*h
c=[0]*w
s=set()
for _ in range(m):
    i,j=map(int,input().split())
    i-=1
    j-=1
    r[i]+=1
    c[j]+=1
    s.add(i*w+j)

rmx=max(r)
cmx=max(c)
rc=[i for i in range(h) if r[i]==rmx]
cc=[j for j in range(w) if c[j]==cmx]

ans=rmx+cmx-1
ok=False
for i in rc:
    for j in cc:
        if i*w+j not in s:
            ans+=1
            ok=True
            break
    if ok:
        break

print(ans) h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m r=[0]*h r [0]*h [0] 0 h c=[0]*w c [0]*w [0] 0 w s=set() s set() set for _ in range(m):
    i,j=map(int,input().split())
    i-=1
    j-=1
    r[i]+=1
    c[j]+=1
    s.add(i*w+j) _ range(m) range m i,j=map(int,input().split()) i map(int,input().split()) map int input().split() ().split () input split j i-=1 i 1 j-=1 j 1 r[i]+=1 r[i] r i 1 c[j]+=1 c[j] c j 1 s.add(i*w+j) s.add s add i*w+j i*w i w j rmx=max(r) rmx max(r) max r cmx=max(c) cmx max(c) max c i for i in range(h) if r[i]==rmx for i in range(h) if r[i]==rmx i range(h) range h r[i]==rmx r[i] r i rmx if r[i]==rmx i rc=[i for i in range(h) if r[i]==rmx] rc [i for i in range(h) if r[i]==rmx] j for j in range(w) if c[j]==cmx for j in range(w) if c[j]==cmx j range(w) range w c[j]==cmx c[j] c j cmx if c[j]==cmx j cc=[j for j in range(w) if c[j]==cmx] cc [j for j in range(w) if c[j]==cmx] ans=rmx+cmx-1 ans rmx+cmx-1 rmx+cmx rmx cmx 1 ok=False ok False for i in rc:
    for j in cc:
        if i*w+j not in s:
            ans+=1
            ok=True
            break
    if ok:
        break i rc for j in cc:
        if i*w+j not in s:
            ans+=1
            ok=True
            break
     j cc if i*w+j not in s:
            ans+=1
            ok=True
            break
     i*w+j not in s i*w+j i*w i w j s ans+=1 ans 1 ok=True ok True break if ok:
        break ok break print(ans) print ans j-=1 1 j rc=[i for i in range(h) if r[i]==rmx] [i for i in range(h) if r[i]==rmx] rc j=map(int,input().split()) map(int,input().split()) j s=set() set() s w,m=map(int,input().split()) map(int,input().split()) w c=[0]*w [0]*w c ans+=1 1 ans cc=[j for j in range(w) if c[j]==cmx] [j for j in range(w) if c[j]==cmx] cc i,j=map(int,input().split()) map(int,input().split()) i r=[0]*h [0]*h r h,w,m=map(int,input().split()) map(int,input().split()) h rmx=max(r) max(r) rmx cmx=max(c) max(c) cmx ans=rmx+cmx-1 rmx+cmx-1 ans m=map(int,input().split()) map(int,input().split()) m ok=False False ok i-=1 1 i ok=True True ok
h,w,m=map(int,input().split())

r=[0]*h
c=[0]*w
s=set()
for _ in range(m):
    i,j=map(int,input().split())
    i-=1
    j-=1
    r[i]+=1
    c[j]+=1
    s.add(i*w+j)

rmx=max(r)
cmx=max(c)
rc=[i for i in range(h) if r[i]==rmx]
cc=[j for j in range(w) if c[j]==cmx]

ans=rmx+cmx-1
ok=False
for i in rc:
    for j in cc:
        if i*w+j not in s:
            ans+=1
            ok=True
            break
    if ok:
        break

print(ans)
