import numpy as np
H, W, M = map(int, input().split())

C = [0] * W
R = [0] * H
S = set()
for _ in range(M):
    h, w = map(int, input().split())
    h, w = h - 1, w - 1  # 0-indexed
    C[w] += 1
    R[h] += 1
    S.add((h, w))

col_max = max(C)
col_idx = [i for i in range(W) if C[i] == col_max]
row_max = max(R)
row_idx = [i for i in range(H) if R[i] == row_max]

ans = col_max + row_max
for r in row_idx:
    for c in col_idx:
        if not (r, c) in S:
            print(ans)
            exit()
print(ans - 1) import numpy as np numpy H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M C = [0] * W C [0] * W [0] 0 W R = [0] * H R [0] * H [0] 0 H S = set() S set() set for _ in range(M):
    h, w = map(int, input().split())
    h, w = h - 1, w - 1  # 0-indexed
    C[w] += 1
    R[h] += 1
    S.add((h, w)) _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h, w = h - 1, w - 1 h h - 1 h 1 w w - 1 w 1 C[w] += 1 C[w] C w 1 R[h] += 1 R[h] R h 1 S.add((h, w)) S.add S add (h, w) h w col_max = max(C) col_max max(C) max C i for i in range(W) if C[i] == col_max for i in range(W) if C[i] == col_max i range(W) range W C[i] == col_max C[i] C i col_max if C[i] == col_max i col_idx = [i for i in range(W) if C[i] == col_max] col_idx [i for i in range(W) if C[i] == col_max] row_max = max(R) row_max max(R) max R i for i in range(H) if R[i] == row_max for i in range(H) if R[i] == row_max i range(H) range H R[i] == row_max R[i] R i row_max if R[i] == row_max i row_idx = [i for i in range(H) if R[i] == row_max] row_idx [i for i in range(H) if R[i] == row_max] ans = col_max + row_max ans col_max + row_max col_max row_max for r in row_idx:
    for c in col_idx:
        if not (r, c) in S:
            print(ans)
            exit() r row_idx for c in col_idx:
        if not (r, c) in S:
            print(ans)
            exit() c col_idx if not (r, c) in S:
            print(ans)
            exit() not (r, c) in S (r, c) in S (r, c) r c S print(ans) print ans exit() exit print(ans - 1) print ans - 1 ans 1 H, W, M = map(int, input().split()) map(int, input().split()) H row_max = max(R) max(R) row_max h, w = map(int, input().split()) map(int, input().split()) h ans = col_max + row_max col_max + row_max ans R = [0] * H [0] * H R w = map(int, input().split()) map(int, input().split()) w M = map(int, input().split()) map(int, input().split()) M row_idx = [i for i in range(H) if R[i] == row_max] [i for i in range(H) if R[i] == row_max] row_idx W, M = map(int, input().split()) map(int, input().split()) W S = set() set() S w = h - 1, w - 1 w - 1 w col_idx = [i for i in range(W) if C[i] == col_max] [i for i in range(W) if C[i] == col_max] col_idx col_max = max(C) max(C) col_max C = [0] * W [0] * W C h, w = h - 1, w - 1 h - 1 h
import numpy as np
H, W, M = map(int, input().split())

C = [0] * W
R = [0] * H
S = set()
for _ in range(M):
    h, w = map(int, input().split())
    h, w = h - 1, w - 1  # 0-indexed
    C[w] += 1
    R[h] += 1
    S.add((h, w))

col_max = max(C)
col_idx = [i for i in range(W) if C[i] == col_max]
row_max = max(R)
row_idx = [i for i in range(H) if R[i] == row_max]

ans = col_max + row_max
for r in row_idx:
    for c in col_idx:
        if not (r, c) in S:
            print(ans)
            exit()
print(ans - 1)
