from collections import defaultdict
H,W,M = map(int,input().split())
L=[]
bomb = defaultdict(lambda: 0)
for i in range(M):
    h,w = map(int,input().split())
    L.append([h-1,w-1])
    bomb[(h-1,w-1)] = 1

h = dict()
w = dict()

for i in range(M):
    val = L[i][0]
    if val in h:
        h[val] += 1
    else:
        h[val] = 1

for i in range(M):
    val = L[i][1]
    if val in w:
        w[val] += 1
    else:
        w[val] = 1

maxh = []
maxw = []
m=-1
for val in h:
    if h[val]>m:
        m = h[val]

for val in h:
    if m==h[val]:
        maxh.append(val)

ans = m
m=-1
for val in w:
    if w[val]>m:
        m=w[val]

for val in w:
    if m==w[val]:
        maxw.append(val)

ans += m
#print(maxh)
#print(maxw)
for mh in maxh:
    for mw in maxw:
        if bomb[(mh,mw)]==0:
            print(ans)
            exit()

print(ans-1) from collections import defaultdict H,W,M = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M L=[] L [] bomb = defaultdict(lambda: 0) bomb defaultdict(lambda: 0) defaultdict lambda: 0 0 for i in range(M):
    h,w = map(int,input().split())
    L.append([h-1,w-1])
    bomb[(h-1,w-1)] = 1 i range(M) range M h,w = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w L.append([h-1,w-1]) L.append L append [h-1,w-1] h-1 h 1 w-1 w 1 bomb[(h-1,w-1)] = 1 bomb[(h-1,w-1)] bomb (h-1,w-1) h-1 h 1 w-1 w 1 1 h = dict() h dict() dict w = dict() w dict() dict for i in range(M):
    val = L[i][0]
    if val in h:
        h[val] += 1
    else:
        h[val] = 1 i range(M) range M val = L[i][0] val L[i][0] [i] L i 0 if val in h:
        h[val] += 1
    else:
        h[val] = 1 val in h val h h[val] += 1 h[val] h val 1 h[val] = 1 h[val] h val 1 for i in range(M):
    val = L[i][1]
    if val in w:
        w[val] += 1
    else:
        w[val] = 1 i range(M) range M val = L[i][1] val L[i][1] [i] L i 1 if val in w:
        w[val] += 1
    else:
        w[val] = 1 val in w val w w[val] += 1 w[val] w val 1 w[val] = 1 w[val] w val 1 maxh = [] maxh [] maxw = [] maxw [] m=-1 m -1 for val in h:
    if h[val]>m:
        m = h[val] val h if h[val]>m:
        m = h[val] h[val]>m h[val] h val m m = h[val] m h[val] h val for val in h:
    if m==h[val]:
        maxh.append(val) val h if m==h[val]:
        maxh.append(val) m==h[val] m h[val] h val maxh.append(val) maxh.append maxh append val ans = m ans m m=-1 m -1 for val in w:
    if w[val]>m:
        m=w[val] val w if w[val]>m:
        m=w[val] w[val]>m w[val] w val m m=w[val] m w[val] w val for val in w:
    if m==w[val]:
        maxw.append(val) val w if m==w[val]:
        maxw.append(val) m==w[val] m w[val] w val maxw.append(val) maxw.append maxw append val ans += m ans m for mh in maxh:
    for mw in maxw:
        if bomb[(mh,mw)]==0:
            print(ans)
            exit() mh maxh for mw in maxw:
        if bomb[(mh,mw)]==0:
            print(ans)
            exit() mw maxw if bomb[(mh,mw)]==0:
            print(ans)
            exit() bomb[(mh,mw)]==0 bomb[(mh,mw)] bomb (mh,mw) mh mw 0 print(ans) print ans exit() exit print(ans-1) print ans-1 ans 1 bomb = defaultdict(lambda: 0) defaultdict(lambda: 0) bomb m=-1 -1 m val = L[i][1] L[i][1] val W,M = map(int,input().split()) map(int,input().split()) W ans = m m ans w = dict() dict() w val = L[i][0] L[i][0] val maxh = [] [] maxh L=[] [] L w = map(int,input().split()) map(int,input().split()) w m=w[val] w[val] m h,w = map(int,input().split()) map(int,input().split()) h M = map(int,input().split()) map(int,input().split()) M m=-1 -1 m maxw = [] [] maxw m = h[val] h[val] m ans += m m ans h = dict() dict() h H,W,M = map(int,input().split()) map(int,input().split()) H
from collections import defaultdict
H,W,M = map(int,input().split())
L=[]
bomb = defaultdict(lambda: 0)
for i in range(M):
    h,w = map(int,input().split())
    L.append([h-1,w-1])
    bomb[(h-1,w-1)] = 1

h = dict()
w = dict()

for i in range(M):
    val = L[i][0]
    if val in h:
        h[val] += 1
    else:
        h[val] = 1

for i in range(M):
    val = L[i][1]
    if val in w:
        w[val] += 1
    else:
        w[val] = 1

maxh = []
maxw = []
m=-1
for val in h:
    if h[val]>m:
        m = h[val]

for val in h:
    if m==h[val]:
        maxh.append(val)

ans = m
m=-1
for val in w:
    if w[val]>m:
        m=w[val]

for val in w:
    if m==w[val]:
        maxw.append(val)

ans += m
#print(maxh)
#print(maxw)
for mh in maxh:
    for mw in maxw:
        if bomb[(mh,mw)]==0:
            print(ans)
            exit()

print(ans-1)