
import sys
input=sys.stdin.readline

h,w,m=map(int,input().split())
hs=dict()
ws=dict()
hw=set()
for i in range(m):
    hi,wi=map(int,input().split())
    if hi-1 in ws:
        ws[hi-1]+=1
    else:
        ws[hi-1]=1
    if wi-1 in hs:
        hs[wi-1]+=1
    else:
        hs[wi-1]=1
    hw.add((hi-1,wi-1))    

wmax=max(list(ws.values()))
hh=[]
for ik,wv in ws.items():
    if wv==wmax:
        hh.append(ik)
hmax=max(list(hs.values()))
ww=[]
for jk,hv in hs.items():
    if hv==hmax:
        ww.append(jk)
        
for hi in hh:
    for wi in ww:
        if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit()
print(wmax+hmax-1) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m hs=dict() hs dict() dict ws=dict() ws dict() dict hw=set() hw set() set for i in range(m):
    hi,wi=map(int,input().split())
    if hi-1 in ws:
        ws[hi-1]+=1
    else:
        ws[hi-1]=1
    if wi-1 in hs:
        hs[wi-1]+=1
    else:
        hs[wi-1]=1
    hw.add((hi-1,wi-1))     i range(m) range m hi,wi=map(int,input().split()) hi map(int,input().split()) map int input().split() ().split () input split wi if hi-1 in ws:
        ws[hi-1]+=1
    else:
        ws[hi-1]=1
     hi-1 in ws hi-1 hi 1 ws ws[hi-1]+=1 ws[hi-1] ws hi-1 hi 1 1 ws[hi-1]=1 ws[hi-1] ws hi-1 hi 1 1 if wi-1 in hs:
        hs[wi-1]+=1
    else:
        hs[wi-1]=1
     wi-1 in hs wi-1 wi 1 hs hs[wi-1]+=1 hs[wi-1] hs wi-1 wi 1 1 hs[wi-1]=1 hs[wi-1] hs wi-1 wi 1 1 hw.add((hi-1,wi-1)) hw.add hw add (hi-1,wi-1) hi-1 hi 1 wi-1 wi 1 wmax=max(list(ws.values())) wmax max(list(ws.values())) max list(ws.values()) list ws.values() ws.values ws values hh=[] hh [] for ik,wv in ws.items():
    if wv==wmax:
        hh.append(ik) ik wv ws.items() ws.items ws items if wv==wmax:
        hh.append(ik) wv==wmax wv wmax hh.append(ik) hh.append hh append ik hmax=max(list(hs.values())) hmax max(list(hs.values())) max list(hs.values()) list hs.values() hs.values hs values ww=[] ww [] for jk,hv in hs.items():
    if hv==hmax:
        ww.append(jk)
         jk hv hs.items() hs.items hs items if hv==hmax:
        ww.append(jk)
         hv==hmax hv hmax ww.append(jk) ww.append ww append jk for hi in hh:
    for wi in ww:
        if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit() hi hh for wi in ww:
        if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit() wi ww if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit() not ((hi,wi) in hw) (hi,wi) in hw (hi,wi) hi wi hw print(wmax+hmax) print wmax+hmax wmax hmax sys.exit() sys.exit sys exit print(wmax+hmax-1) print wmax+hmax-1 wmax+hmax wmax hmax 1 ww=[] [] ww hmax=max(list(hs.values())) max(list(hs.values())) hmax hs=dict() dict() hs hh=[] [] hh h,w,m=map(int,input().split()) map(int,input().split()) h hi,wi=map(int,input().split()) map(int,input().split()) hi ws=dict() dict() ws wi=map(int,input().split()) map(int,input().split()) wi hw=set() set() hw m=map(int,input().split()) map(int,input().split()) m input=sys.stdin.readline sys.stdin.readline input wmax=max(list(ws.values())) max(list(ws.values())) wmax w,m=map(int,input().split()) map(int,input().split()) w

import sys
input=sys.stdin.readline

h,w,m=map(int,input().split())
hs=dict()
ws=dict()
hw=set()
for i in range(m):
    hi,wi=map(int,input().split())
    if hi-1 in ws:
        ws[hi-1]+=1
    else:
        ws[hi-1]=1
    if wi-1 in hs:
        hs[wi-1]+=1
    else:
        hs[wi-1]=1
    hw.add((hi-1,wi-1))    

wmax=max(list(ws.values()))
hh=[]
for ik,wv in ws.items():
    if wv==wmax:
        hh.append(ik)
hmax=max(list(hs.values()))
ww=[]
for jk,hv in hs.items():
    if hv==hmax:
        ww.append(jk)
        
for hi in hh:
    for wi in ww:
        if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit()
print(wmax+hmax-1)
