H, W, M = list(map(int, input().split()))
hrz = [0]*H
vrt = [0]*W
targets = set()
for _ in range(M):
    h, w = list(map(lambda x: int(x) - 1, input().split()))
    targets.add((h, w))
    hrz[h] += 1
    vrt[w] += 1

hrz_max = max(hrz)
vrt_max = max(vrt)
hrz_max_lines = [i for i in range(H) if hrz[i] == hrz_max]
vrt_max_lines = [i for i in range(W) if vrt[i] == vrt_max]
for h in hrz_max_lines:
    for w in vrt_max_lines:
        if not (h, w) in targets:
            print(hrz_max+vrt_max)
            exit()
print(hrz_max+vrt_max-1) H, W, M = list(map(int, input().split())) H list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split W M hrz = [0]*H hrz [0]*H [0] 0 H vrt = [0]*W vrt [0]*W [0] 0 W targets = set() targets set() set for _ in range(M):
    h, w = list(map(lambda x: int(x) - 1, input().split()))
    targets.add((h, w))
    hrz[h] += 1
    vrt[w] += 1 _ range(M) range M h, w = list(map(lambda x: int(x) - 1, input().split())) h list(map(lambda x: int(x) - 1, input().split())) list map(lambda x: int(x) - 1, input().split()) map lambda x: int(x) - 1 int(x) - 1 int(x) int x 1 x input().split() ().split () input split w targets.add((h, w)) targets.add targets add (h, w) h w hrz[h] += 1 hrz[h] hrz h 1 vrt[w] += 1 vrt[w] vrt w 1 hrz_max = max(hrz) hrz_max max(hrz) max hrz vrt_max = max(vrt) vrt_max max(vrt) max vrt i for i in range(H) if hrz[i] == hrz_max for i in range(H) if hrz[i] == hrz_max i range(H) range H hrz[i] == hrz_max hrz[i] hrz i hrz_max if hrz[i] == hrz_max i hrz_max_lines = [i for i in range(H) if hrz[i] == hrz_max] hrz_max_lines [i for i in range(H) if hrz[i] == hrz_max] i for i in range(W) if vrt[i] == vrt_max for i in range(W) if vrt[i] == vrt_max i range(W) range W vrt[i] == vrt_max vrt[i] vrt i vrt_max if vrt[i] == vrt_max i vrt_max_lines = [i for i in range(W) if vrt[i] == vrt_max] vrt_max_lines [i for i in range(W) if vrt[i] == vrt_max] for h in hrz_max_lines:
    for w in vrt_max_lines:
        if not (h, w) in targets:
            print(hrz_max+vrt_max)
            exit() h hrz_max_lines for w in vrt_max_lines:
        if not (h, w) in targets:
            print(hrz_max+vrt_max)
            exit() w vrt_max_lines if not (h, w) in targets:
            print(hrz_max+vrt_max)
            exit() not (h, w) in targets (h, w) in targets (h, w) h w targets print(hrz_max+vrt_max) print hrz_max+vrt_max hrz_max vrt_max exit() exit print(hrz_max+vrt_max-1) print hrz_max+vrt_max-1 hrz_max+vrt_max hrz_max vrt_max 1 hrz_max_lines = [i for i in range(H) if hrz[i] == hrz_max] [i for i in range(H) if hrz[i] == hrz_max] hrz_max_lines targets = set() set() targets M = list(map(int, input().split())) list(map(int, input().split())) M vrt = [0]*W [0]*W vrt vrt_max = max(vrt) max(vrt) vrt_max w = list(map(lambda x: int(x) - 1, input().split())) list(map(lambda x: int(x) - 1, input().split())) w H, W, M = list(map(int, input().split())) list(map(int, input().split())) H W, M = list(map(int, input().split())) list(map(int, input().split())) W hrz = [0]*H [0]*H hrz vrt_max_lines = [i for i in range(W) if vrt[i] == vrt_max] [i for i in range(W) if vrt[i] == vrt_max] vrt_max_lines h, w = list(map(lambda x: int(x) - 1, input().split())) list(map(lambda x: int(x) - 1, input().split())) h hrz_max = max(hrz) max(hrz) hrz_max
H, W, M = list(map(int, input().split()))
hrz = [0]*H
vrt = [0]*W
targets = set()
for _ in range(M):
    h, w = list(map(lambda x: int(x) - 1, input().split()))
    targets.add((h, w))
    hrz[h] += 1
    vrt[w] += 1

hrz_max = max(hrz)
vrt_max = max(vrt)
hrz_max_lines = [i for i in range(H) if hrz[i] == hrz_max]
vrt_max_lines = [i for i in range(W) if vrt[i] == vrt_max]
for h in hrz_max_lines:
    for w in vrt_max_lines:
        if not (h, w) in targets:
            print(hrz_max+vrt_max)
            exit()
print(hrz_max+vrt_max-1)
