H, W, M = map(int, input().split())
 
hs = [0] * H
ws = [0] * W
boms = set()
 
for i in range(M):
    r,c = map(int, input().split())
    r -= 1
    c -= 1
 
    hs[r] += 1
    ws[c] += 1
    boms.add((r, c))
mh, mw = 0, 0
for i in range(H):
    mh = max(mh, hs[i])
for j in range(W):
    mw = max(mw, ws[j])
max_h_list = []
max_w_list = []
    
for i in range(H):
    if hs[i] == mh: max_h_list.append(i)    
for j in range(W):
    if ws[j] == mw: max_w_list.append(j)
ans = mh + mw
 
for i in max_h_list:
    for j in max_w_list:
        if (i,j) not in boms:
            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 hs = [0] * H hs [0] * H [0] 0 H ws = [0] * W ws [0] * W [0] 0 W boms = set() boms set() set for i in range(M):
    r,c = map(int, input().split())
    r -= 1
    c -= 1
 
    hs[r] += 1
    ws[c] += 1
    boms.add((r, c)) i range(M) range M r,c = map(int, input().split()) r map(int, input().split()) map int input().split() ().split () input split c r -= 1 r 1 c -= 1 c 1 hs[r] += 1 hs[r] hs r 1 ws[c] += 1 ws[c] ws c 1 boms.add((r, c)) boms.add boms add (r, c) r c mh, mw = 0, 0 mh 0 mw 0 for i in range(H):
    mh = max(mh, hs[i]) i range(H) range H mh = max(mh, hs[i]) mh max(mh, hs[i]) max mh hs[i] hs i for j in range(W):
    mw = max(mw, ws[j]) j range(W) range W mw = max(mw, ws[j]) mw max(mw, ws[j]) max mw ws[j] ws j max_h_list = [] max_h_list [] max_w_list = [] max_w_list [] for i in range(H):
    if hs[i] == mh: max_h_list.append(i)     i range(H) range H if hs[i] == mh: max_h_list.append(i) hs[i] == mh hs[i] hs i mh for j in range(W):
    if ws[j] == mw: max_w_list.append(j) j range(W) range W if ws[j] == mw: max_w_list.appen ws[j] == mw ws[j] ws j mw ans = mh + mw ans mh + mw mh mw for i in max_h_list:
    for j in max_w_list:
        if (i,j) not in boms:
            print(ans)
            exit() i max_h_list for j in max_w_list:
        if (i,j) not in boms:
            print(ans)
            exit() j max_w_list if (i,j) not in boms:
            print(ans)
            exit() (i,j) not in boms (i,j) i j boms print(ans) print ans exit() exit print(ans-1) print ans-1 ans 1 mh = max(mh, hs[i]) max(mh, hs[i]) mh r,c = map(int, input().split()) map(int, input().split()) r ans = mh + mw mh + mw ans mh, mw = 0, 0 0 mh H, W, M = map(int, input().split()) map(int, input().split()) H mw = 0, 0 0 mw mw = max(mw, ws[j]) max(mw, ws[j]) mw c -= 1 1 c max_h_list = [] [] max_h_list hs = [0] * H [0] * H hs max_w_list = [] [] max_w_list r -= 1 1 r W, M = map(int, input().split()) map(int, input().split()) W ws = [0] * W [0] * W ws M = map(int, input().split()) map(int, input().split()) M c = map(int, input().split()) map(int, input().split()) c boms = set() set() boms
H, W, M = map(int, input().split())
 
hs = [0] * H
ws = [0] * W
boms = set()
 
for i in range(M):
    r,c = map(int, input().split())
    r -= 1
    c -= 1
 
    hs[r] += 1
    ws[c] += 1
    boms.add((r, c))
mh, mw = 0, 0
for i in range(H):
    mh = max(mh, hs[i])
for j in range(W):
    mw = max(mw, ws[j])
max_h_list = []
max_w_list = []
    
for i in range(H):
    if hs[i] == mh: max_h_list.append(i)    
for j in range(W):
    if ws[j] == mw: max_w_list.append(j)
ans = mh + mw
 
for i in max_h_list:
    for j in max_w_list:
        if (i,j) not in boms:
            print(ans)
            exit()
print(ans-1) 