h, w, m = map(int, input().split())
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
xs = []
ys = []
for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    xs.append(x)
    ys.append(y)
h_max = max(h_cnt)
w_max = max(w_cnt)
h_max_induce = {i: v for i, v in enumerate(h_cnt) if v == h_max}
w_max_induce = {i: v for i, v in enumerate(w_cnt) if v == w_max}

cnt = 0
for i in range(m):
    x = xs[i]
    y = ys[i]
    if x in w_max_induce and y in h_max_induce:
        cnt += 1
if cnt == len(h_max_induce.keys())*len(w_max_induce.keys()):
    print(h_max+w_max-1)
else:
    print(h_max+w_max)

 h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m 0 for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) 0 h_cnt = [0 for _ in range(h)] h_cnt [0 for _ in range(h)] 0 for _ in range(w) for _ in range(w) _ range(w) range w for _ in range(w) 0 w_cnt = [0 for _ in range(w)] w_cnt [0 for _ in range(w)] xs = [] xs [] ys = [] ys [] for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    xs.append(x)
    ys.append(y) _ range(m) range m y, x = map(int, input().split()) y map(int, input().split()) map int input().split() ().split () input split x y -= 1 y 1 x -= 1 x 1 h_cnt[y] += 1 h_cnt[y] h_cnt y 1 w_cnt[x] += 1 w_cnt[x] w_cnt x 1 xs.append(x) xs.append xs append x ys.append(y) ys.append ys append y h_max = max(h_cnt) h_max max(h_cnt) max h_cnt w_max = max(w_cnt) w_max max(w_cnt) max w_cnt i: v for i, v in enumerate(h_cnt) if v == h_max for i, v in enumerate(h_cnt) if v == h_max i v enumerate(h_cnt) enumerate h_cnt i v == h_max v h_max if v == h_max i v h_max_induce = {i: v for i, v in enumerate(h_cnt) if v == h_max} h_max_induce {i: v for i, v in enumerate(h_cnt) if v == h_max} i: v for i, v in enumerate(w_cnt) if v == w_max for i, v in enumerate(w_cnt) if v == w_max i v enumerate(w_cnt) enumerate w_cnt i v == w_max v w_max if v == w_max i v w_max_induce = {i: v for i, v in enumerate(w_cnt) if v == w_max} w_max_induce {i: v for i, v in enumerate(w_cnt) if v == w_max} cnt = 0 cnt 0 for i in range(m):
    x = xs[i]
    y = ys[i]
    if x in w_max_induce and y in h_max_induce:
        cnt += 1 i range(m) range m x = xs[i] x xs[i] xs i y = ys[i] y ys[i] ys i if x in w_max_induce and y in h_max_induce:
        cnt += 1 x in w_max_induce and y in h_max_induce x in w_max_induce x w_max_induce y in h_max_induce y h_max_induce cnt += 1 cnt 1 if cnt == len(h_max_induce.keys())*len(w_max_induce.keys()):
    print(h_max+w_max-1)
else:
    print(h_max+w_max) cnt == len(h_max_induce.keys())*len(w_max_induce.keys()) cnt len(h_max_induce.keys())*len(w_max_induce.keys()) len(h_max_induce.keys()) len h_max_induce.keys() h_max_induce.keys h_max_induce keys len(w_max_induce.keys()) len w_max_induce.keys() w_max_induce.keys w_max_induce keys print(h_max+w_max-1) print h_max+w_max-1 h_max+w_max h_max w_max 1 print(h_max+w_max) print h_max+w_max h_max w_max y -= 1 1 y x -= 1 1 x x = xs[i] xs[i] x h_cnt = [0 for _ in range(h)] [0 for _ in range(h)] h_cnt y = ys[i] ys[i] y w_cnt = [0 for _ in range(w)] [0 for _ in range(w)] w_cnt ys = [] [] ys h_max_induce = {i: v for i, v in enumerate(h_cnt) if v == h_max} {i: v for i, v in enumerate(h_cnt) if v == h_max} h_max_induce m = map(int, input().split()) map(int, input().split()) m w_max = max(w_cnt) max(w_cnt) w_max w_max_induce = {i: v for i, v in enumerate(w_cnt) if v == w_max} {i: v for i, v in enumerate(w_cnt) if v == w_max} w_max_induce y, x = map(int, input().split()) map(int, input().split()) y cnt = 0 0 cnt h, w, m = map(int, input().split()) map(int, input().split()) h w, m = map(int, input().split()) map(int, input().split()) w h_max = max(h_cnt) max(h_cnt) h_max xs = [] [] xs x = map(int, input().split()) map(int, input().split()) x cnt += 1 1 cnt
h, w, m = map(int, input().split())
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
xs = []
ys = []
for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    xs.append(x)
    ys.append(y)
h_max = max(h_cnt)
w_max = max(w_cnt)
h_max_induce = {i: v for i, v in enumerate(h_cnt) if v == h_max}
w_max_induce = {i: v for i, v in enumerate(w_cnt) if v == w_max}

cnt = 0
for i in range(m):
    x = xs[i]
    y = ys[i]
    if x in w_max_induce and y in h_max_induce:
        cnt += 1
if cnt == len(h_max_induce.keys())*len(w_max_induce.keys()):
    print(h_max+w_max-1)
else:
    print(h_max+w_max)


