H,W,M = map(int,input().split())
X = {}
CH = {}
CW = {}
for _ in range(M):
    h,w = map(int,input().split())
    X[(h,w)] = 1
    if h not in CH:
        CH[h] = 0
    CH[h] += 1
    if w not in CW:
        CW[w] = 0
    CW[w] += 1
hmax = 0
for h in CH:
    hmax = max(hmax,CH[h])
A = []
for h in CH:
    if CH[h]==hmax:
        A.append(h)
wmax = 0
for w in CW:
    wmax = max(wmax,CW[w])
B = []
for w in CW:
    if CW[w]==wmax:
        B.append(w)
flag = 0
for h in A:
    for w in B:
        if (h,w) not in X:
            flag = 1
            break
    if flag==1:break
if flag==1:
    print(hmax+wmax)
else:
    print(hmax+wmax-1) H,W,M = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M X = {} X {} CH = {} CH {} CW = {} CW {} for _ in range(M):
    h,w = map(int,input().split())
    X[(h,w)] = 1
    if h not in CH:
        CH[h] = 0
    CH[h] += 1
    if w not in CW:
        CW[w] = 0
    CW[w] += 1 _ range(M) range M h,w = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w X[(h,w)] = 1 X[(h,w)] X (h,w) h w 1 if h not in CH:
        CH[h] = 0
     h not in CH h CH CH[h] = 0 CH[h] CH h 0 CH[h] += 1 CH[h] CH h 1 if w not in CW:
        CW[w] = 0
     w not in CW w CW CW[w] = 0 CW[w] CW w 0 CW[w] += 1 CW[w] CW w 1 hmax = 0 hmax 0 for h in CH:
    hmax = max(hmax,CH[h]) h CH hmax = max(hmax,CH[h]) hmax max(hmax,CH[h]) max hmax CH[h] CH h A = [] A [] for h in CH:
    if CH[h]==hmax:
        A.append(h) h CH if CH[h]==hmax:
        A.append(h) CH[h]==hmax CH[h] CH h hmax A.append(h) A.append A append h wmax = 0 wmax 0 for w in CW:
    wmax = max(wmax,CW[w]) w CW wmax = max(wmax,CW[w]) wmax max(wmax,CW[w]) max wmax CW[w] CW w B = [] B [] for w in CW:
    if CW[w]==wmax:
        B.append(w) w CW if CW[w]==wmax:
        B.append(w) CW[w]==wmax CW[w] CW w wmax B.append(w) B.append B append w flag = 0 flag 0 for h in A:
    for w in B:
        if (h,w) not in X:
            flag = 1
            break
    if flag==1:break h A for w in B:
        if (h,w) not in X:
            flag = 1
            break
     w B if (h,w) not in X:
            flag = 1
            break
     (h,w) not in X (h,w) h w X flag = 1 flag 1 break if flag==1:b flag==1 flag 1 if flag==1:
    print(hmax+wmax)
else:
    print(hmax+wmax-1) flag==1 flag 1 print(hmax+wmax) print hmax+wmax hmax wmax print(hmax+wmax-1) print hmax+wmax-1 hmax+wmax hmax wmax 1 h,w = map(int,input().split()) map(int,input().split()) h flag = 1 1 flag H,W,M = map(int,input().split()) map(int,input().split()) H CH = {} {} CH B = [] [] B flag = 0 0 flag wmax = 0 0 wmax w = map(int,input().split()) map(int,input().split()) w W,M = map(int,input().split()) map(int,input().split()) W M = map(int,input().split()) map(int,input().split()) M wmax = max(wmax,CW[w]) max(wmax,CW[w]) wmax CW = {} {} CW hmax = max(hmax,CH[h]) max(hmax,CH[h]) hmax A = [] [] A hmax = 0 0 hmax X = {} {} X
H,W,M = map(int,input().split())
X = {}
CH = {}
CW = {}
for _ in range(M):
    h,w = map(int,input().split())
    X[(h,w)] = 1
    if h not in CH:
        CH[h] = 0
    CH[h] += 1
    if w not in CW:
        CW[w] = 0
    CW[w] += 1
hmax = 0
for h in CH:
    hmax = max(hmax,CH[h])
A = []
for h in CH:
    if CH[h]==hmax:
        A.append(h)
wmax = 0
for w in CW:
    wmax = max(wmax,CW[w])
B = []
for w in CW:
    if CW[w]==wmax:
        B.append(w)
flag = 0
for h in A:
    for w in B:
        if (h,w) not in X:
            flag = 1
            break
    if flag==1:break
if flag==1:
    print(hmax+wmax)
else:
    print(hmax+wmax-1)