H,W,M=map(int,input().split())
bomb=[]
h=[0]*H
w=[0]*W
for i in range(M):
    hi,wi=map(int,input().split())
    h[hi-1] += 1
    w[wi-1] += 1
    bomb.append([hi,wi])    
maxh = max(h)
maxw = max(w)
ans = maxh +  maxw
lh=[]
lw=[]
for i in range(len(h)):
    if h[i] == maxh:
        lh.append(i+1)
for i in range(len(w)):
    if w[i] == maxw:
        lw.append(i+1)
a = 0
for i in range(M):
    if ans == h[bomb[i][0]-1]+w[bomb[i][1]-1]:
        a += 1
if a == len(lh)*len(lw):
    print(ans-1)
else:
    print(ans) H,W,M=map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M bomb=[] bomb [] h=[0]*H h [0]*H [0] 0 H w=[0]*W w [0]*W [0] 0 W for i in range(M):
    hi,wi=map(int,input().split())
    h[hi-1] += 1
    w[wi-1] += 1
    bomb.append([hi,wi])     i range(M) range M hi,wi=map(int,input().split()) hi map(int,input().split()) map int input().split() ().split () input split wi h[hi-1] += 1 h[hi-1] h hi-1 hi 1 1 w[wi-1] += 1 w[wi-1] w wi-1 wi 1 1 bomb.append([hi,wi]) bomb.append bomb append [hi,wi] hi wi maxh = max(h) maxh max(h) max h maxw = max(w) maxw max(w) max w ans = maxh +  maxw ans maxh +  maxw maxh maxw lh=[] lh [] lw=[] lw [] for i in range(len(h)):
    if h[i] == maxh:
        lh.append(i+1) i range(len(h)) range len(h) len h if h[i] == maxh:
        lh.append(i+1) h[i] == maxh h[i] h i maxh lh.append(i+1) lh.append lh append i+1 i 1 for i in range(len(w)):
    if w[i] == maxw:
        lw.append(i+1) i range(len(w)) range len(w) len w if w[i] == maxw:
        lw.append(i+1) w[i] == maxw w[i] w i maxw lw.append(i+1) lw.append lw append i+1 i 1 a = 0 a 0 for i in range(M):
    if ans == h[bomb[i][0]-1]+w[bomb[i][1]-1]:
        a += 1 i range(M) range M if ans == h[bomb[i][0]-1]+w[bomb[i][1]-1]:
        a += 1 ans == h[bomb[i][0]-1]+w[bomb[i][1]-1] ans h[bomb[i][0]-1]+w[bomb[i][1]-1] h[bomb[i][0]-1] h bomb[i][0]-1 bomb[i][0] [i] bomb i 0 1 w[bomb[i][1]-1] w bomb[i][1]-1 bomb[i][1] [i] bomb i 1 1 a += 1 a 1 if a == len(lh)*len(lw):
    print(ans-1)
else:
    print(ans) a == len(lh)*len(lw) a len(lh)*len(lw) len(lh) len lh len(lw) len lw print(ans-1) print ans-1 ans 1 print(ans) print ans W,M=map(int,input().split()) map(int,input().split()) W lh=[] [] lh H,W,M=map(int,input().split()) map(int,input().split()) H a = 0 0 a bomb=[] [] bomb wi=map(int,input().split()) map(int,input().split()) wi a += 1 1 a M=map(int,input().split()) map(int,input().split()) M w=[0]*W [0]*W w hi,wi=map(int,input().split()) map(int,input().split()) hi lw=[] [] lw maxw = max(w) max(w) maxw h=[0]*H [0]*H h maxh = max(h) max(h) maxh ans = maxh +  maxw maxh +  maxw ans
H,W,M=map(int,input().split())
bomb=[]
h=[0]*H
w=[0]*W
for i in range(M):
    hi,wi=map(int,input().split())
    h[hi-1] += 1
    w[wi-1] += 1
    bomb.append([hi,wi])    
maxh = max(h)
maxw = max(w)
ans = maxh +  maxw
lh=[]
lw=[]
for i in range(len(h)):
    if h[i] == maxh:
        lh.append(i+1)
for i in range(len(w)):
    if w[i] == maxw:
        lw.append(i+1)
a = 0
for i in range(M):
    if ans == h[bomb[i][0]-1]+w[bomb[i][1]-1]:
        a += 1
if a == len(lh)*len(lw):
    print(ans-1)
else:
    print(ans)