import sys
H, W, M = map(int, input().split())
h_list, w_list = [0]*H, [0]*W
check = set()
for _ in range(M):
    h, w = map(int, input().split())
    check.add((h-1, w-1))
    h_list[h-1] += 1
    w_list[w-1] += 1
h_max, w_max = max(h_list), max(w_list)
h_bom = [i for i in range(H) if h_list[i]==h_max]
w_bom = [i for i in range(W) if w_list[i]==w_max]
for h in h_bom:
    for w in w_bom:
        if not (h, w) in check:
            print(h_max+w_max)
            sys.exit()
print(h_max+w_max-1) import sys sys H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M h_list, w_list = [0]*H, [0]*W h_list [0]*H [0] 0 H w_list [0]*W [0] 0 W check = set() check set() set for _ in range(M):
    h, w = map(int, input().split())
    check.add((h-1, w-1))
    h_list[h-1] += 1
    w_list[w-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 check.add((h-1, w-1)) check.add check add (h-1, w-1) h-1 h 1 w-1 w 1 h_list[h-1] += 1 h_list[h-1] h_list h-1 h 1 1 w_list[w-1] += 1 w_list[w-1] w_list w-1 w 1 1 h_max, w_max = max(h_list), max(w_list) h_max max(h_list) max h_list w_max max(w_list) max w_list i for i in range(H) if h_list[i]==h_max for i in range(H) if h_list[i]==h_max i range(H) range H h_list[i]==h_max h_list[i] h_list i h_max if h_list[i]==h_max i h_bom = [i for i in range(H) if h_list[i]==h_max] h_bom [i for i in range(H) if h_list[i]==h_max] i for i in range(W) if w_list[i]==w_max for i in range(W) if w_list[i]==w_max i range(W) range W w_list[i]==w_max w_list[i] w_list i w_max if w_list[i]==w_max i w_bom = [i for i in range(W) if w_list[i]==w_max] w_bom [i for i in range(W) if w_list[i]==w_max] for h in h_bom:
    for w in w_bom:
        if not (h, w) in check:
            print(h_max+w_max)
            sys.exit() h h_bom for w in w_bom:
        if not (h, w) in check:
            print(h_max+w_max)
            sys.exit() w w_bom if not (h, w) in check:
            print(h_max+w_max)
            sys.exit() not (h, w) in check (h, w) in check (h, w) h w check print(h_max+w_max) print h_max+w_max h_max w_max sys.exit() sys.exit sys exit print(h_max+w_max-1) print h_max+w_max-1 h_max+w_max h_max w_max 1 check = set() set() check w_list = [0]*H, [0]*W [0]*W w_list M = map(int, input().split()) map(int, input().split()) M H, W, M = map(int, input().split()) map(int, input().split()) H h_list, w_list = [0]*H, [0]*W [0]*H h_list h, w = map(int, input().split()) map(int, input().split()) h w_max = max(h_list), max(w_list) max(w_list) w_max w = map(int, input().split()) map(int, input().split()) w w_bom = [i for i in range(W) if w_list[i]==w_max] [i for i in range(W) if w_list[i]==w_max] w_bom W, M = map(int, input().split()) map(int, input().split()) W h_max, w_max = max(h_list), max(w_list) max(h_list) h_max h_bom = [i for i in range(H) if h_list[i]==h_max] [i for i in range(H) if h_list[i]==h_max] h_bom
import sys
H, W, M = map(int, input().split())
h_list, w_list = [0]*H, [0]*W
check = set()
for _ in range(M):
    h, w = map(int, input().split())
    check.add((h-1, w-1))
    h_list[h-1] += 1
    w_list[w-1] += 1
h_max, w_max = max(h_list), max(w_list)
h_bom = [i for i in range(H) if h_list[i]==h_max]
w_bom = [i for i in range(W) if w_list[i]==w_max]
for h in h_bom:
    for w in w_bom:
        if not (h, w) in check:
            print(h_max+w_max)
            sys.exit()
print(h_max+w_max-1)