from collections import Counter
H, W, M = list(map(int, input().split()))
h = [0]*M
w = [0]*M
for i in range(M):
    h[i], w[i] = list(map(int, input().split()))
hc = Counter(h)
wc = Counter(w)
hmax = max(hc.values())
wmax = max(wc.values())
lh = {k[0] for k in hc.items() if k[1] == hmax}
lw = {k[0] for k in wc.items() if k[1] == wmax}

ct = 0
for i in range(M):
    if h[i] in lh and w[i] in lw:
        ct += 1
if ct >= len(lh)*len(lw):
    print(hmax+wmax-1)
else:
    print(hmax+wmax) from collections import Counter H, W, M = list(map(int, input().split())) H list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split W M h = [0]*M h [0]*M [0] 0 M w = [0]*M w [0]*M [0] 0 M for i in range(M):
    h[i], w[i] = list(map(int, input().split())) i range(M) range M h[i], w[i] = list(map(int, input().split())) h[i] h i list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split w[i] w i hc = Counter(h) hc Counter(h) Counter h wc = Counter(w) wc Counter(w) Counter w hmax = max(hc.values()) hmax max(hc.values()) max hc.values() hc.values hc values wmax = max(wc.values()) wmax max(wc.values()) max wc.values() wc.values wc values k[0] for k in hc.items() if k[1] == hmax for k in hc.items() if k[1] == hmax k hc.items() hc.items hc items k[1] == hmax k[1] k 1 hmax if k[1] == hmax k[0] k 0 lh = {k[0] for k in hc.items() if k[1] == hmax} lh k[0] for k in wc.items() if k[1] == wmax for k in wc.items() if k[1] == wmax k wc.items() wc.items wc items k[1] == wmax k[1] k 1 wmax if k[1] == wmax k[0] k 0 lw = {k[0] for k in wc.items() if k[1] == wmax} lw ct = 0 ct 0 for i in range(M):
    if h[i] in lh and w[i] in lw:
        ct += 1 i range(M) range M if h[i] in lh and w[i] in lw:
        ct += 1 h[i] in lh and w[i] in lw h[i] in lh h[i] h i lh w[i] in lw w[i] w i lw ct += 1 ct 1 if ct >= len(lh)*len(lw):
    print(hmax+wmax-1)
else:
    print(hmax+wmax) ct >= len(lh)*len(lw) ct len(lh)*len(lw) len(lh) len lh len(lw) len lw print(hmax+wmax-1) print hmax+wmax-1 hmax+wmax hmax wmax 1 print(hmax+wmax) print hmax+wmax hmax wmax lh = {k[0] for k in hc.items() if k[1] == hmax} lh M = list(map(int, input().split())) list(map(int, input().split())) M ct = 0 0 ct w = [0]*M [0]*M w lw = {k[0] for k in wc.items() if k[1] == wmax} lw hc = Counter(h) Counter(h) hc ct += 1 1 ct hmax = max(hc.values()) max(hc.values()) hmax W, M = list(map(int, input().split())) list(map(int, input().split())) W h = [0]*M [0]*M h wc = Counter(w) Counter(w) wc H, W, M = list(map(int, input().split())) list(map(int, input().split())) H wmax = max(wc.values()) max(wc.values()) wmax
from collections import Counter
H, W, M = list(map(int, input().split()))
h = [0]*M
w = [0]*M
for i in range(M):
    h[i], w[i] = list(map(int, input().split()))
hc = Counter(h)
wc = Counter(w)
hmax = max(hc.values())
wmax = max(wc.values())
lh = {k[0] for k in hc.items() if k[1] == hmax}
lw = {k[0] for k in wc.items() if k[1] == wmax}

ct = 0
for i in range(M):
    if h[i] in lh and w[i] in lw:
        ct += 1
if ct >= len(lh)*len(lw):
    print(hmax+wmax-1)
else:
    print(hmax+wmax)