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

xsct=[0]*w
ysct=[0]*h
ips=set()
xsmx=ysmx=0
for _ in range(m):
    y,x=map(int,input().split())
    x,y=x-1,y-1
    xsct[x]+=1
    ysct[y]+=1
    ips.add((x,y))
    xsmx=max(xsmx,xsct[x])
    ysmx=max(ysmx,ysct[y])

xs=[x for x in range(w) if xsct[x]==xsmx]
ys=[y for y in range(h) if ysct[y]==ysmx]

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

xsct=[0]*w
ysct=[0]*h
ips=set()
xsmx=ysmx=0
for _ in range(m):
    y,x=map(int,input().split())
    x,y=x-1,y-1
    xsct[x]+=1
    ysct[y]+=1
    ips.add((x,y))
    xsmx=max(xsmx,xsct[x])
    ysmx=max(ysmx,ysct[y])

xs=[x for x in range(w) if xsct[x]==xsmx]
ys=[y for y in range(h) if ysct[y]==ysmx]

ans=xsmx+ysmx-1
ok=False
for y in ys:
    for x in xs:
        if (x,y) not in ips:
            ans+=1
            ok=True
            break
    if ok:
        break

print(ans)
