R, C, T = map(int, input().split())
RC = []
for _ in range(T):
    RC.append(list(map(int, input().split())))
TR = [0] * (R + 1)
TC = [0] * (C + 1)
for r, c in RC:
    TR[r] += 1
    TC[c] += 1
mxr = max(TR)
mxc = max(TC)
ct = TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc])
print(mxc + mxr - (ct == 0)) R, C, T = map(int, input().split()) R map(int, input().split()) map int input().split() ().split () input split C T RC = [] RC [] for _ in range(T):
    RC.append(list(map(int, input().split()))) _ range(T) range T RC.append(list(map(int, input().split()))) RC.append RC append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split TR = [0] * (R + 1) TR [0] * (R + 1) [0] 0 R + 1 R 1 TC = [0] * (C + 1) TC [0] * (C + 1) [0] 0 C + 1 C 1 for r, c in RC:
    TR[r] += 1
    TC[c] += 1 r c RC TR[r] += 1 TR[r] TR r 1 TC[c] += 1 TC[c] TC c 1 mxr = max(TR) mxr max(TR) max TR mxc = max(TC) mxc max(TC) max TC 0 for r, c in RC if TR[r] == mxr and TC[c] == mxc for r, c in RC if TR[r] == mxr and TC[c] == mxc r c RC TR[r] == mxr and TC[c] == mxc TR[r] == mxr TR[r] TR r mxr TC[c] == mxc TC[c] TC c mxc if TR[r] == mxr and TC[c] == mxc 0 ct = TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc]) ct TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc]) TR.count(mxr) * TC.count(mxc) TR.count(mxr) TR.count TR count mxr TC.count(mxc) TC.count TC count mxc len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc]) len [0 for r, c in RC if TR[r] == mxr and TC[c] == mxc] print(mxc + mxr - (ct == 0)) print mxc + mxr - (ct == 0) mxc + mxr mxc mxr ct == 0 ct 0 C, T = map(int, input().split()) map(int, input().split()) C RC = [] [] RC R, C, T = map(int, input().split()) map(int, input().split()) R mxc = max(TC) max(TC) mxc TC = [0] * (C + 1) [0] * (C + 1) TC TR = [0] * (R + 1) [0] * (R + 1) TR T = map(int, input().split()) map(int, input().split()) T mxr = max(TR) max(TR) mxr ct = TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc]) TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc]) ct
R, C, T = map(int, input().split())
RC = []
for _ in range(T):
    RC.append(list(map(int, input().split())))
TR = [0] * (R + 1)
TC = [0] * (C + 1)
for r, c in RC:
    TR[r] += 1
    TC[c] += 1
mxr = max(TR)
mxc = max(TC)
ct = TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc])
print(mxc + mxr - (ct == 0))