import sys
input = sys.stdin.buffer.readline
 
H, W, M = map(int, input().split())
 
X = [0] * W
Y = [0] * H
Map = []
 
for _ in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))
 
MX = max(X)
MY = max(Y)
ans = MX + MY
Xans = set()
Yans = set()
for i, x in enumerate(X):
    if x == MX:
        Xans.add(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.add(i)
cnt = 0
for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1
if cnt == len(Xans) * len(Yans):
    ans -= 1
print(ans) import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M X = [0] * W X [0] * W [0] 0 W Y = [0] * H Y [0] * H [0] 0 H Map = [] Map [] for _ in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))
  _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h -= 1 h 1 w -= 1 w 1 Y[h] += 1 Y[h] Y h 1 X[w] += 1 X[w] X w 1 Map.append((h, w)) Map.append Map append (h, w) h w MX = max(X) MX max(X) max X MY = max(Y) MY max(Y) max Y ans = MX + MY ans MX + MY MX MY Xans = set() Xans set() set Yans = set() Yans set() set for i, x in enumerate(X):
    if x == MX:
        Xans.add(i) i x enumerate(X) enumerate X if x == MX:
        Xans.add(i) x == MX x MX Xans.add(i) Xans.add Xans add i for i, y in enumerate(Y):
    if y == MY:
        Yans.add(i) i y enumerate(Y) enumerate Y if y == MY:
        Yans.add(i) y == MY y MY Yans.add(i) Yans.add Yans add i cnt = 0 cnt 0 for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1 h w Map if h in Yans and w in Xans:
        cnt += 1 h in Yans and w in Xans h in Yans h Yans w in Xans w Xans cnt += 1 cnt 1 if cnt == len(Xans) * len(Yans):
    ans -= 1 cnt == len(Xans) * len(Yans) cnt len(Xans) * len(Yans) len(Xans) len Xans len(Yans) len Yans ans -= 1 ans 1 print(ans) print ans input = sys.stdin.buffer.readline sys.stdin.buffer.readline input Yans = set() set() Yans ans -= 1 1 ans w -= 1 1 w Map = [] [] Map h -= 1 1 h W, M = map(int, input().split()) map(int, input().split()) W H, W, M = map(int, input().split()) map(int, input().split()) H ans = MX + MY MX + MY ans cnt += 1 1 cnt Y = [0] * H [0] * H Y MX = max(X) max(X) MX X = [0] * W [0] * W X Xans = set() set() Xans w = map(int, input().split()) map(int, input().split()) w h, w = map(int, input().split()) map(int, input().split()) h cnt = 0 0 cnt MY = max(Y) max(Y) MY M = map(int, input().split()) map(int, input().split()) M
import sys
input = sys.stdin.buffer.readline
 
H, W, M = map(int, input().split())
 
X = [0] * W
Y = [0] * H
Map = []
 
for _ in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))
 
MX = max(X)
MY = max(Y)
ans = MX + MY
Xans = set()
Yans = set()
for i, x in enumerate(X):
    if x == MX:
        Xans.add(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.add(i)
cnt = 0
for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1
if cnt == len(Xans) * len(Yans):
    ans -= 1
print(ans)