H, W, M = map(int, input().split())

visited = set()

h_sum = [0] * H
w_sum = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    visited.add((h, w))
    h_sum[h] += 1
    w_sum[w] += 1

max_h = max_w = 0
can_h = []
can_w = []
for i in range(H):
    max_h = max(max_h, h_sum[i])
    
for i in range(W):
    max_w = max(max_w, w_sum[i])

for i in range(H):
    if h_sum[i] == max_h:
        can_h.append(i)
for i in range(W):
    if w_sum[i] == max_w:
        can_w.append(i)
        
ans = max_h + max_w

for i in can_h:
    for j in can_w:
        if (i, j) not in visited:
            print(ans)
            exit()

print(ans-1) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M visited = set() visited set() set h_sum = [0] * H h_sum [0] * H [0] 0 H w_sum = [0] * W w_sum [0] * W [0] 0 W for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    visited.add((h, w))
    h_sum[h] += 1
    w_sum[w] += 1 i range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h -= 1 h 1 w -= 1 w 1 visited.add((h, w)) visited.add visited add (h, w) h w h_sum[h] += 1 h_sum[h] h_sum h 1 w_sum[w] += 1 w_sum[w] w_sum w 1 max_h = max_w = 0 max_h 0 = max_w = 0 max_w 0 can_h = [] can_h [] can_w = [] can_w [] for i in range(H):
    max_h = max(max_h, h_sum[i])
     i range(H) range H max_h = max(max_h, h_sum[i]) max_h max(max_h, h_sum[i]) max max_h h_sum[i] h_sum i for i in range(W):
    max_w = max(max_w, w_sum[i]) i range(W) range W max_w = max(max_w, w_sum[i]) max_w max(max_w, w_sum[i]) max max_w w_sum[i] w_sum i for i in range(H):
    if h_sum[i] == max_h:
        can_h.append(i) i range(H) range H if h_sum[i] == max_h:
        can_h.append(i) h_sum[i] == max_h h_sum[i] h_sum i max_h can_h.append(i) can_h.append can_h append i for i in range(W):
    if w_sum[i] == max_w:
        can_w.append(i)
         i range(W) range W if w_sum[i] == max_w:
        can_w.append(i)
         w_sum[i] == max_w w_sum[i] w_sum i max_w can_w.append(i) can_w.append can_w append i ans = max_h + max_w ans max_h + max_w max_h max_w for i in can_h:
    for j in can_w:
        if (i, j) not in visited:
            print(ans)
            exit() i can_h for j in can_w:
        if (i, j) not in visited:
            print(ans)
            exit() j can_w if (i, j) not in visited:
            print(ans)
            exit() (i, j) not in visited (i, j) i j visited print(ans) print ans exit() exit print(ans-1) print ans-1 ans 1 ans = max_h + max_w max_h + max_w ans max_w = 0 0 max_w H, W, M = map(int, input().split()) map(int, input().split()) H w -= 1 1 w h -= 1 1 h max_h = max(max_h, h_sum[i]) max(max_h, h_sum[i]) max_h M = map(int, input().split()) map(int, input().split()) M W, M = map(int, input().split()) map(int, input().split()) W max_w = max(max_w, w_sum[i]) max(max_w, w_sum[i]) max_w h_sum = [0] * H [0] * H h_sum visited = set() set() visited w = map(int, input().split()) map(int, input().split()) w can_w = [] [] can_w max_h = max_w = 0 0 max_h h, w = map(int, input().split()) map(int, input().split()) h can_h = [] [] can_h w_sum = [0] * W [0] * W w_sum
H, W, M = map(int, input().split())

visited = set()

h_sum = [0] * H
w_sum = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    visited.add((h, w))
    h_sum[h] += 1
    w_sum[w] += 1

max_h = max_w = 0
can_h = []
can_w = []
for i in range(H):
    max_h = max(max_h, h_sum[i])
    
for i in range(W):
    max_w = max(max_w, w_sum[i])

for i in range(H):
    if h_sum[i] == max_h:
        can_h.append(i)
for i in range(W):
    if w_sum[i] == max_w:
        can_w.append(i)
        
ans = max_h + max_w

for i in can_h:
    for j in can_w:
        if (i, j) not in visited:
            print(ans)
            exit()

print(ans-1)