import sys

H, W, M = map(int, input().split())
A = [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)]

cnth = [0] * H
cntw = [0] * W
st = set()

for y, x in A:
    cnth[y] += 1
    cntw[x] += 1
    st.add((y, x))

my = max(cnth)
mx = max(cntw)

Y = []
X = []

for i in range(H):
    if cnth[i] == my:
        Y.append(i)

for i in range(W):
    if cntw[i] == mx:
        X.append(i)

for y in Y:
    for x in X:
        if not (y, x) in st:
            print(my + mx)
            exit(0)

print(my + mx - 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 list(map(lambda x: int(x) - 1, input().split())) for i in range(M) for i in range(M) i range(M) range M for i in range(M) 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 A = [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)] A [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)] cnth = [0] * H cnth [0] * H [0] 0 H cntw = [0] * W cntw [0] * W [0] 0 W st = set() st set() set for y, x in A:
    cnth[y] += 1
    cntw[x] += 1
    st.add((y, x)) y x A cnth[y] += 1 cnth[y] cnth y 1 cntw[x] += 1 cntw[x] cntw x 1 st.add((y, x)) st.add st add (y, x) y x my = max(cnth) my max(cnth) max cnth mx = max(cntw) mx max(cntw) max cntw Y = [] Y [] X = [] X [] for i in range(H):
    if cnth[i] == my:
        Y.append(i) i range(H) range H if cnth[i] == my:
        Y.append(i) cnth[i] == my cnth[i] cnth i my Y.append(i) Y.append Y append i for i in range(W):
    if cntw[i] == mx:
        X.append(i) i range(W) range W if cntw[i] == mx:
        X.append(i) cntw[i] == mx cntw[i] cntw i mx X.append(i) X.append X append i for y in Y:
    for x in X:
        if not (y, x) in st:
            print(my + mx)
            exit(0) y Y for x in X:
        if not (y, x) in st:
            print(my + mx)
            exit(0) x X if not (y, x) in st:
            print(my + mx)
            exit(0) not (y, x) in st (y, x) in st (y, x) y x st print(my + mx) print my + mx my mx exit(0) exit 0 print(my + mx - 1) print my + mx - 1 my + mx my mx 1 cnth = [0] * H [0] * H cnth H, W, M = map(int, input().split()) map(int, input().split()) H my = max(cnth) max(cnth) my st = set() set() st Y = [] [] Y mx = max(cntw) max(cntw) mx W, M = map(int, input().split()) map(int, input().split()) W cntw = [0] * W [0] * W cntw X = [] [] X M = map(int, input().split()) map(int, input().split()) M A = [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)] [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)] A
import sys

H, W, M = map(int, input().split())
A = [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)]

cnth = [0] * H
cntw = [0] * W
st = set()

for y, x in A:
    cnth[y] += 1
    cntw[x] += 1
    st.add((y, x))

my = max(cnth)
mx = max(cntw)

Y = []
X = []

for i in range(H):
    if cnth[i] == my:
        Y.append(i)

for i in range(W):
    if cntw[i] == mx:
        X.append(i)

for y in Y:
    for x in X:
        if not (y, x) in st:
            print(my + mx)
            exit(0)

print(my + mx - 1)
