import sys
def input():
    return sys.stdin.readline()[:-1]
H,W,M=map(int,input().split())
s={tuple(map(lambda x: int(x)-1, input().split())) for i in range(M)}
lh=[0]*H
lw=[0]*W
for i in s:
    lh[i[0]]+=1
    lw[i[1]]+=1
mh=max(lh)
mw=max(lw)
sh=[]
sw=[]
for i in range(H):
    if lh[i]==mh:
        sh.append(i)
for i in range(W):
    if lw[i]==mw:
        sw.append(i)
if len(sh)*len(sw)>M:
    print(mh+mw)
else:
    for i in sh:
        for j in sw:
            if (i,j) not in s:
                print(mh+mw)
                break
        else:
            continue
        break
    else:
        print(mh+mw-1) import sys sys def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 H,W,M=map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M tuple(map(lambda x: int(x)-1, input().split())) for i in range(M) for i in range(M) i range(M) range M for i in range(M) tuple(map(lambda x: int(x)-1, input().split())) tuple 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 s={tuple(map(lambda x: int(x)-1, input().split())) for i in range(M)} s lh=[0]*H lh [0]*H [0] 0 H lw=[0]*W lw [0]*W [0] 0 W for i in s:
    lh[i[0]]+=1
    lw[i[1]]+=1 i s lh[i[0]]+=1 lh[i[0]] lh i[0] i 0 1 lw[i[1]]+=1 lw[i[1]] lw i[1] i 1 1 mh=max(lh) mh max(lh) max lh mw=max(lw) mw max(lw) max lw sh=[] sh [] sw=[] sw [] for i in range(H):
    if lh[i]==mh:
        sh.append(i) i range(H) range H if lh[i]==mh:
        sh.append(i) lh[i]==mh lh[i] lh i mh sh.append(i) sh.append sh append i for i in range(W):
    if lw[i]==mw:
        sw.append(i) i range(W) range W if lw[i]==mw:
        sw.append(i) lw[i]==mw lw[i] lw i mw sw.append(i) sw.append sw append i if len(sh)*len(sw)>M:
    print(mh+mw)
else:
    for i in sh:
        for j in sw:
            if (i,j) not in s:
                print(mh+mw)
                break
        else:
            continue
        break
    else:
        print(mh+mw-1) len(sh)*len(sw)>M len(sh)*len(sw) len(sh) len sh len(sw) len sw M print(mh+mw) print mh+mw mh mw for i in sh:
        for j in sw:
            if (i,j) not in s:
                print(mh+mw)
                break
        else:
            continue
        break
    else:
        print(mh+mw-1) i sh for j in sw:
            if (i,j) not in s:
                print(mh+mw)
                break
        else:
            continue
         j sw if (i,j) not in s:
                print(mh+mw)
                break
         (i,j) not in s (i,j) i j s print(mh+mw) print mh+mw mh mw break continue break print(mh+mw-1) print mh+mw-1 mh+mw mh mw 1 mh=max(lh) max(lh) mh lw=[0]*W [0]*W lw sh=[] [] sh W,M=map(int,input().split()) map(int,input().split()) W mw=max(lw) max(lw) mw sw=[] [] sw H,W,M=map(int,input().split()) map(int,input().split()) H s={tuple(map(lambda x: int(x)-1, input().split())) for i in range(M)} s lh=[0]*H [0]*H lh def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input M=map(int,input().split()) map(int,input().split()) M
import sys
def input():
    return sys.stdin.readline()[:-1]
H,W,M=map(int,input().split())
s={tuple(map(lambda x: int(x)-1, input().split())) for i in range(M)}
lh=[0]*H
lw=[0]*W
for i in s:
    lh[i[0]]+=1
    lw[i[1]]+=1
mh=max(lh)
mw=max(lw)
sh=[]
sw=[]
for i in range(H):
    if lh[i]==mh:
        sh.append(i)
for i in range(W):
    if lw[i]==mw:
        sw.append(i)
if len(sh)*len(sw)>M:
    print(mh+mw)
else:
    for i in sh:
        for j in sw:
            if (i,j) not in s:
                print(mh+mw)
                break
        else:
            continue
        break
    else:
        print(mh+mw-1)