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

cx=[0]*w
cy=[0]*h
xy=set()
for _ in range(m):
    y,x=map(int,input().split())
    x,y=x-1,y-1
    cx[x]+=1
    cy[y]+=1
    xy.add((x,y))

xmx=max(cx)
ymx=max(cy)
xs=[x for x in range(w) if cx[x]==xmx]
ys=[y for y in range(h) if cy[y]==ymx]

ans=xmx+ymx-1
ok=False
for y in ys:
    for x in xs:
        if (x,y) not in xy:
            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 cx=[0]*w cx [0]*w [0] 0 w cy=[0]*h cy [0]*h [0] 0 h xy=set() xy set() set for _ in range(m):
    y,x=map(int,input().split())
    x,y=x-1,y-1
    cx[x]+=1
    cy[y]+=1
    xy.add((x,y)) _ range(m) range m y,x=map(int,input().split()) y map(int,input().split()) map int input().split() ().split () input split x x,y=x-1,y-1 x x-1 x 1 y y-1 y 1 cx[x]+=1 cx[x] cx x 1 cy[y]+=1 cy[y] cy y 1 xy.add((x,y)) xy.add xy add (x,y) x y xmx=max(cx) xmx max(cx) max cx ymx=max(cy) ymx max(cy) max cy x for x in range(w) if cx[x]==xmx for x in range(w) if cx[x]==xmx x range(w) range w cx[x]==xmx cx[x] cx x xmx if cx[x]==xmx x xs=[x for x in range(w) if cx[x]==xmx] xs [x for x in range(w) if cx[x]==xmx] y for y in range(h) if cy[y]==ymx for y in range(h) if cy[y]==ymx y range(h) range h cy[y]==ymx cy[y] cy y ymx if cy[y]==ymx y ys=[y for y in range(h) if cy[y]==ymx] ys [y for y in range(h) if cy[y]==ymx] ans=xmx+ymx-1 ans xmx+ymx-1 xmx+ymx xmx ymx 1 ok=False ok False for y in ys:
    for x in xs:
        if (x,y) not in xy:
            ans+=1
            ok=True
            break
    if ok:
        break y ys for x in xs:
        if (x,y) not in xy:
            ans+=1
            ok=True
            break
     x xs if (x,y) not in xy:
            ans+=1
            ok=True
            break
     (x,y) not in xy (x,y) x y xy ans+=1 ans 1 ok=True ok True break if ok:
        break ok break print(ans) print ans cx=[0]*w [0]*w cx xs=[x for x in range(w) if cx[x]==xmx] [x for x in range(w) if cx[x]==xmx] xs h,w,m=map(int,input().split()) map(int,input().split()) h cy=[0]*h [0]*h cy w,m=map(int,input().split()) map(int,input().split()) w y,x=map(int,input().split()) map(int,input().split()) y x,y=x-1,y-1 x-1 x x=map(int,input().split()) map(int,input().split()) x xy=set() set() xy ok=True True ok ans=xmx+ymx-1 xmx+ymx-1 ans ys=[y for y in range(h) if cy[y]==ymx] [y for y in range(h) if cy[y]==ymx] ys ok=False False ok y=x-1,y-1 y-1 y xmx=max(cx) max(cx) xmx ymx=max(cy) max(cy) ymx m=map(int,input().split()) map(int,input().split()) m ans+=1 1 ans
h,w,m=map(int,input().split())

cx=[0]*w
cy=[0]*h
xy=set()
for _ in range(m):
    y,x=map(int,input().split())
    x,y=x-1,y-1
    cx[x]+=1
    cy[y]+=1
    xy.add((x,y))

xmx=max(cx)
ymx=max(cy)
xs=[x for x in range(w) if cx[x]==xmx]
ys=[y for y in range(h) if cy[y]==ymx]

ans=xmx+ymx-1
ok=False
for y in ys:
    for x in xs:
        if (x,y) not in xy:
            ans+=1
            ok=True
            break
    if ok:
        break

print(ans)
