H, W, M = map(int, input().split())
bomb = []
h_sum = [0]*W
w_sum = [0]*H
for _ in range(M):
    h, w = map(int, input().split())
    bomb.append((h,w))
    h_sum[w-1] += 1
    w_sum[h-1] += 1
max_h = max(h_sum)
max_w = max(w_sum)
target_cnt = h_sum.count(max_h)*w_sum.count(max_w)
for h, w in bomb:
    if h_sum[w-1] == max_h and w_sum[h-1] == max_w:
        target_cnt -= 1
if target_cnt == 0:
    print(max_h+max_w-1)
else:
    print(max_h+max_w) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M bomb = [] bomb [] h_sum = [0]*W h_sum [0]*W [0] 0 W w_sum = [0]*H w_sum [0]*H [0] 0 H for _ in range(M):
    h, w = map(int, input().split())
    bomb.append((h,w))
    h_sum[w-1] += 1
    w_sum[h-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 bomb.append((h,w)) bomb.append bomb append (h,w) h w h_sum[w-1] += 1 h_sum[w-1] h_sum w-1 w 1 1 w_sum[h-1] += 1 w_sum[h-1] w_sum h-1 h 1 1 max_h = max(h_sum) max_h max(h_sum) max h_sum max_w = max(w_sum) max_w max(w_sum) max w_sum target_cnt = h_sum.count(max_h)*w_sum.count(max_w) target_cnt h_sum.count(max_h)*w_sum.count(max_w) h_sum.count(max_h) h_sum.count h_sum count max_h w_sum.count(max_w) w_sum.count w_sum count max_w for h, w in bomb:
    if h_sum[w-1] == max_h and w_sum[h-1] == max_w:
        target_cnt -= 1 h w bomb if h_sum[w-1] == max_h and w_sum[h-1] == max_w:
        target_cnt -= 1 h_sum[w-1] == max_h and w_sum[h-1] == max_w h_sum[w-1] == max_h h_sum[w-1] h_sum w-1 w 1 max_h w_sum[h-1] == max_w w_sum[h-1] w_sum h-1 h 1 max_w target_cnt -= 1 target_cnt 1 if target_cnt == 0:
    print(max_h+max_w-1)
else:
    print(max_h+max_w) target_cnt == 0 target_cnt 0 print(max_h+max_w-1) print max_h+max_w-1 max_h+max_w max_h max_w 1 print(max_h+max_w) print max_h+max_w max_h max_w w = map(int, input().split()) map(int, input().split()) w h_sum = [0]*W [0]*W h_sum target_cnt -= 1 1 target_cnt H, W, M = map(int, input().split()) map(int, input().split()) H max_h = max(h_sum) max(h_sum) max_h M = map(int, input().split()) map(int, input().split()) M bomb = [] [] bomb max_w = max(w_sum) max(w_sum) max_w W, M = map(int, input().split()) map(int, input().split()) W h, w = map(int, input().split()) map(int, input().split()) h w_sum = [0]*H [0]*H w_sum target_cnt = h_sum.count(max_h)*w_sum.count(max_w) h_sum.count(max_h)*w_sum.count(max_w) target_cnt
H, W, M = map(int, input().split())
bomb = []
h_sum = [0]*W
w_sum = [0]*H
for _ in range(M):
    h, w = map(int, input().split())
    bomb.append((h,w))
    h_sum[w-1] += 1
    w_sum[h-1] += 1
max_h = max(h_sum)
max_w = max(w_sum)
target_cnt = h_sum.count(max_h)*w_sum.count(max_w)
for h, w in bomb:
    if h_sum[w-1] == max_h and w_sum[h-1] == max_w:
        target_cnt -= 1
if target_cnt == 0:
    print(max_h+max_w-1)
else:
    print(max_h+max_w)