H, W, m = map(int, input().split())
xs = [0] * H
ys = [0] * W
s = set()
for _ in range(m):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    xs[h] += 1
    ys[w] += 1
    s.add((h, w))

mx = max(xs)
my = max(ys)
mxs = set()
for i in range(H):
    if xs[i] == mx:
        mxs.add(i)
mys = set()
for i in range(W):
    if ys[i] == my:
        mys.add(i)
for x in mxs:
    for y in mys:
        if not (x, y) in s:
            print(mx + my)
            exit()
print(mx + my - 1) H, W, m = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W m xs = [0] * H xs [0] * H [0] 0 H ys = [0] * W ys [0] * W [0] 0 W s = set() s set() set for _ in range(m):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    xs[h] += 1
    ys[w] += 1
    s.add((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 xs[h] += 1 xs[h] xs h 1 ys[w] += 1 ys[w] ys w 1 s.add((h, w)) s.add s add (h, w) h w mx = max(xs) mx max(xs) max xs my = max(ys) my max(ys) max ys mxs = set() mxs set() set for i in range(H):
    if xs[i] == mx:
        mxs.add(i) i range(H) range H if xs[i] == mx:
        mxs.add(i) xs[i] == mx xs[i] xs i mx mxs.add(i) mxs.add mxs add i mys = set() mys set() set for i in range(W):
    if ys[i] == my:
        mys.add(i) i range(W) range W if ys[i] == my:
        mys.add(i) ys[i] == my ys[i] ys i my mys.add(i) mys.add mys add i for x in mxs:
    for y in mys:
        if not (x, y) in s:
            print(mx + my)
            exit() x mxs for y in mys:
        if not (x, y) in s:
            print(mx + my)
            exit() y mys if not (x, y) in s:
            print(mx + my)
            exit() not (x, y) in s (x, y) in s (x, y) x y s print(mx + my) print mx + my mx my exit() exit print(mx + my - 1) print mx + my - 1 mx + my mx my 1 mx = max(xs) max(xs) mx s = set() set() s mxs = set() set() mxs H, W, m = map(int, input().split()) map(int, input().split()) H ys = [0] * W [0] * W ys w -= 1 1 w h -= 1 1 h h, w = map(int, input().split()) map(int, input().split()) h xs = [0] * H [0] * H xs W, m = map(int, input().split()) map(int, input().split()) W m = map(int, input().split()) map(int, input().split()) m w = map(int, input().split()) map(int, input().split()) w my = max(ys) max(ys) my mys = set() set() mys
H, W, m = map(int, input().split())
xs = [0] * H
ys = [0] * W
s = set()
for _ in range(m):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    xs[h] += 1
    ys[w] += 1
    s.add((h, w))

mx = max(xs)
my = max(ys)
mxs = set()
for i in range(H):
    if xs[i] == mx:
        mxs.add(i)
mys = set()
for i in range(W):
    if ys[i] == my:
        mys.add(i)
for x in mxs:
    for y in mys:
        if not (x, y) in s:
            print(mx + my)
            exit()
print(mx + my - 1)
