H, W, M = map(int, input().split())
hw = set()
sum_h = [0] * W
sum_w = [0] * H
for _ in range(M):
    h, w = map(int, input().split())
    hw.add((h, w))
    h -= 1
    w -= 1
    sum_h[w] += 1
    sum_w[h] += 1


max_h = max(sum_h)
max_w = max(sum_w)

new_H = [h for h in range(H) if sum_w[h] == max_w]
new_W = [w for w in range(W) if sum_h[w] == max_h]

max_num = max_h + max_w - 1
for i in new_H:
    for j in new_W:
        if (i + 1, j + 1) not in hw:
            print(max_h + max_w)
            exit()
        else:
            continue
        break

print(max_num) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M hw = set() hw set() set sum_h = [0] * W sum_h [0] * W [0] 0 W sum_w = [0] * H sum_w [0] * H [0] 0 H for _ in range(M):
    h, w = map(int, input().split())
    hw.add((h, w))
    h -= 1
    w -= 1
    sum_h[w] += 1
    sum_w[h] += 1 _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w hw.add((h, w)) hw.add hw add (h, w) h w h -= 1 h 1 w -= 1 w 1 sum_h[w] += 1 sum_h[w] sum_h w 1 sum_w[h] += 1 sum_w[h] sum_w h 1 max_h = max(sum_h) max_h max(sum_h) max sum_h max_w = max(sum_w) max_w max(sum_w) max sum_w h for h in range(H) if sum_w[h] == max_w for h in range(H) if sum_w[h] == max_w h range(H) range H sum_w[h] == max_w sum_w[h] sum_w h max_w if sum_w[h] == max_w h new_H = [h for h in range(H) if sum_w[h] == max_w] new_H [h for h in range(H) if sum_w[h] == max_w] w for w in range(W) if sum_h[w] == max_h for w in range(W) if sum_h[w] == max_h w range(W) range W sum_h[w] == max_h sum_h[w] sum_h w max_h if sum_h[w] == max_h w new_W = [w for w in range(W) if sum_h[w] == max_h] new_W [w for w in range(W) if sum_h[w] == max_h] max_num = max_h + max_w - 1 max_num max_h + max_w - 1 max_h + max_w max_h max_w 1 for i in new_H:
    for j in new_W:
        if (i + 1, j + 1) not in hw:
            print(max_h + max_w)
            exit()
        else:
            continue
        break i new_H for j in new_W:
        if (i + 1, j + 1) not in hw:
            print(max_h + max_w)
            exit()
        else:
            continue
        break j new_W if (i + 1, j + 1) not in hw:
            print(max_h + max_w)
            exit()
        else:
            continue
         (i + 1, j + 1) not in hw (i + 1, j + 1) i + 1 i 1 j + 1 j 1 hw print(max_h + max_w) print max_h + max_w max_h max_w exit() exit continue break print(max_num) print max_num max_w = max(sum_w) max(sum_w) max_w h -= 1 1 h M = map(int, input().split()) map(int, input().split()) M new_H = [h for h in range(H) if sum_w[h] == max_w] [h for h in range(H) if sum_w[h] == max_w] new_H new_W = [w for w in range(W) if sum_h[w] == max_h] [w for w in range(W) if sum_h[w] == max_h] new_W max_h = max(sum_h) max(sum_h) max_h sum_h = [0] * W [0] * W sum_h hw = set() set() hw W, M = map(int, input().split()) map(int, input().split()) W w = map(int, input().split()) map(int, input().split()) w H, W, M = map(int, input().split()) map(int, input().split()) H max_num = max_h + max_w - 1 max_h + max_w - 1 max_num sum_w = [0] * H [0] * H sum_w w -= 1 1 w h, w = map(int, input().split()) map(int, input().split()) h
H, W, M = map(int, input().split())
hw = set()
sum_h = [0] * W
sum_w = [0] * H
for _ in range(M):
    h, w = map(int, input().split())
    hw.add((h, w))
    h -= 1
    w -= 1
    sum_h[w] += 1
    sum_w[h] += 1


max_h = max(sum_h)
max_w = max(sum_w)

new_H = [h for h in range(H) if sum_w[h] == max_w]
new_W = [w for w in range(W) if sum_h[w] == max_h]

max_num = max_h + max_w - 1
for i in new_H:
    for j in new_W:
        if (i + 1, j + 1) not in hw:
            print(max_h + max_w)
            exit()
        else:
            continue
        break

print(max_num)
