h,w,m=map(int,input().split())
row=[0 for i in range(h)]
col=[0 for i in range(w)]
a=[]
for i in range(m):
    r,c=map(lambda x:int(x)-1,input().split())
    a.append([r,c])
    row[r]+=1
    col[c]+=1
rmax=max(row)
cmax=max(col)
ans=rmax+cmax
flag=row.count(rmax)*col.count(cmax)
for i,j in a:
    if(row[i]==rmax and col[j]==cmax):
        flag-=1
if(flag==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 0 for i in range(h) for i in range(h) i range(h) range h for i in range(h) 0 row=[0 for i in range(h)] row [0 for i in range(h)] 0 for i in range(w) for i in range(w) i range(w) range w for i in range(w) 0 col=[0 for i in range(w)] col [0 for i in range(w)] a=[] a [] for i in range(m):
    r,c=map(lambda x:int(x)-1,input().split())
    a.append([r,c])
    row[r]+=1
    col[c]+=1 i range(m) range m r,c=map(lambda x:int(x)-1,input().split()) r 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 c a.append([r,c]) a.append a append [r,c] r c row[r]+=1 row[r] row r 1 col[c]+=1 col[c] col c 1 rmax=max(row) rmax max(row) max row cmax=max(col) cmax max(col) max col ans=rmax+cmax ans rmax+cmax rmax cmax flag=row.count(rmax)*col.count(cmax) flag row.count(rmax)*col.count(cmax) row.count(rmax) row.count row count rmax col.count(cmax) col.count col count cmax for i,j in a:
    if(row[i]==rmax and col[j]==cmax):
        flag-=1 i j a if(row[i]==rmax and col[j]==cmax):
        flag-=1 row[i]==rmax and col[j]==cmax row[i]==rmax row[i] row i rmax col[j]==cmax col[j] col j cmax flag-=1 flag 1 if(flag==0):
    ans-=1 flag==0 flag 0 ans-=1 ans 1 print(ans) print ans flag-=1 1 flag cmax=max(col) max(col) cmax m=map(int,input().split()) map(int,input().split()) m ans-=1 1 ans c=map(lambda x:int(x)-1,input().split()) map(lambda x:int(x)-1,input().split()) c col=[0 for i in range(w)] [0 for i in range(w)] col rmax=max(row) max(row) rmax r,c=map(lambda x:int(x)-1,input().split()) map(lambda x:int(x)-1,input().split()) r h,w,m=map(int,input().split()) map(int,input().split()) h w,m=map(int,input().split()) map(int,input().split()) w ans=rmax+cmax rmax+cmax ans row=[0 for i in range(h)] [0 for i in range(h)] row flag=row.count(rmax)*col.count(cmax) row.count(rmax)*col.count(cmax) flag a=[] [] a
h,w,m=map(int,input().split())
row=[0 for i in range(h)]
col=[0 for i in range(w)]
a=[]
for i in range(m):
    r,c=map(lambda x:int(x)-1,input().split())
    a.append([r,c])
    row[r]+=1
    col[c]+=1
rmax=max(row)
cmax=max(col)
ans=rmax+cmax
flag=row.count(rmax)*col.count(cmax)
for i,j in a:
    if(row[i]==rmax and col[j]==cmax):
        flag-=1
if(flag==0):
    ans-=1
print(ans)