import sys
from collections import defaultdict

input = sys.stdin.readline

H, W, m = map(int, input().split())

hor = [0] * H
ver = [0] * W
f = defaultdict(int)
for _ in range(m):
    h, w = map(int, input().split())
    hor[h - 1] += 1
    ver[w - 1] += 1
    f[str(h - 1) + '|' + str(w - 1)] = 1

hmax = max(hor)
hs = [i for i, v in enumerate(hor) if v == hmax]
vmax = max(ver)
vs = [i for i, v in enumerate(ver) if v == vmax]


ans = hmax + vmax

if len(hs) * len(vs) > m:
    print(ans)
    exit()

for k1 in hs:
    for k2 in vs:
        if f[str(k1) + '|' + str(k2)] == 0:
            print(ans)
            exit()
print(ans - 1) import sys sys from collections import defaultdict input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline H, W, m = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W m hor = [0] * H hor [0] * H [0] 0 H ver = [0] * W ver [0] * W [0] 0 W f = defaultdict(int) f defaultdict(int) defaultdict int for _ in range(m):
    h, w = map(int, input().split())
    hor[h - 1] += 1
    ver[w - 1] += 1
    f[str(h - 1) + '|' + str(w - 1)] = 1 _ range(m) range m h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w hor[h - 1] += 1 hor[h - 1] hor h - 1 h 1 1 ver[w - 1] += 1 ver[w - 1] ver w - 1 w 1 1 f[str(h - 1) + '|' + str(w - 1)] = 1 f[str(h - 1) + '|' + str(w - 1)] f str(h - 1) + '|' + str(w - 1) str(h - 1) + '|' str(h - 1) str h - 1 h 1 '|' str(w - 1) str w - 1 w 1 1 hmax = max(hor) hmax max(hor) max hor i for i, v in enumerate(hor) if v == hmax for i, v in enumerate(hor) if v == hmax i v enumerate(hor) enumerate hor v == hmax v hmax if v == hmax i hs = [i for i, v in enumerate(hor) if v == hmax] hs [i for i, v in enumerate(hor) if v == hmax] vmax = max(ver) vmax max(ver) max ver i for i, v in enumerate(ver) if v == vmax for i, v in enumerate(ver) if v == vmax i v enumerate(ver) enumerate ver v == vmax v vmax if v == vmax i vs = [i for i, v in enumerate(ver) if v == vmax] vs [i for i, v in enumerate(ver) if v == vmax] ans = hmax + vmax ans hmax + vmax hmax vmax if len(hs) * len(vs) > m:
    print(ans)
    exit() len(hs) * len(vs) > m len(hs) * len(vs) len(hs) len hs len(vs) len vs m print(ans) print ans exit() exit for k1 in hs:
    for k2 in vs:
        if f[str(k1) + '|' + str(k2)] == 0:
            print(ans)
            exit() k1 hs for k2 in vs:
        if f[str(k1) + '|' + str(k2)] == 0:
            print(ans)
            exit() k2 vs if f[str(k1) + '|' + str(k2)] == 0:
            print(ans)
            exit() f[str(k1) + '|' + str(k2)] == 0 f[str(k1) + '|' + str(k2)] f str(k1) + '|' + str(k2) str(k1) + '|' str(k1) str k1 '|' str(k2) str k2 0 print(ans) print ans exit() exit print(ans - 1) print ans - 1 ans 1 H, W, m = map(int, input().split()) map(int, input().split()) H ans = hmax + vmax hmax + vmax ans W, m = map(int, input().split()) map(int, input().split()) W vs = [i for i, v in enumerate(ver) if v == vmax] [i for i, v in enumerate(ver) if v == vmax] vs m = map(int, input().split()) map(int, input().split()) m h, w = map(int, input().split()) map(int, input().split()) h hs = [i for i, v in enumerate(hor) if v == hmax] [i for i, v in enumerate(hor) if v == hmax] hs input = sys.stdin.readline sys.stdin.readline input ver = [0] * W [0] * W ver hmax = max(hor) max(hor) hmax w = map(int, input().split()) map(int, input().split()) w hor = [0] * H [0] * H hor vmax = max(ver) max(ver) vmax f = defaultdict(int) defaultdict(int) f
import sys
from collections import defaultdict

input = sys.stdin.readline

H, W, m = map(int, input().split())

hor = [0] * H
ver = [0] * W
f = defaultdict(int)
for _ in range(m):
    h, w = map(int, input().split())
    hor[h - 1] += 1
    ver[w - 1] += 1
    f[str(h - 1) + '|' + str(w - 1)] = 1

hmax = max(hor)
hs = [i for i, v in enumerate(hor) if v == hmax]
vmax = max(ver)
vs = [i for i, v in enumerate(ver) if v == vmax]


ans = hmax + vmax

if len(hs) * len(vs) > m:
    print(ans)
    exit()

for k1 in hs:
    for k2 in vs:
        if f[str(k1) + '|' + str(k2)] == 0:
            print(ans)
            exit()
print(ans - 1)
