h,w,m=map(int, input().split())
hw=[list(map(int, input().split())) for _ in range(m)]

y_list=[0]*h
x_list=[0]*w

for h_i, w_i in hw:
    y_list[h_i-1]+=1
    x_list[w_i-1]+=1

my_cnt=max(y_list)
mx_cnt=max(x_list)

y_cnt=0
x_cnt=0

my_set=set()
mx_set=set()

for h_i, w_i in hw:
    if y_list[h_i-1]==my_cnt:
        my_set.add(h_i-1)
    if x_list[w_i-1]==mx_cnt:
        mx_set.add(w_i-1)

cnt=0
for h_i, w_i in hw:
    if y_list[h_i-1]==my_cnt and x_list[w_i-1]==mx_cnt:
        cnt+=1

print(my_cnt+mx_cnt-1 if cnt==len(my_set)*len(mx_set) else my_cnt+mx_cnt) h,w,m=map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m list(map(int, input().split())) for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split hw=[list(map(int, input().split())) for _ in range(m)] hw [list(map(int, input().split())) for _ in range(m)] y_list=[0]*h y_list [0]*h [0] 0 h x_list=[0]*w x_list [0]*w [0] 0 w for h_i, w_i in hw:
    y_list[h_i-1]+=1
    x_list[w_i-1]+=1 h_i w_i hw y_list[h_i-1]+=1 y_list[h_i-1] y_list h_i-1 h_i 1 1 x_list[w_i-1]+=1 x_list[w_i-1] x_list w_i-1 w_i 1 1 my_cnt=max(y_list) my_cnt max(y_list) max y_list mx_cnt=max(x_list) mx_cnt max(x_list) max x_list y_cnt=0 y_cnt 0 x_cnt=0 x_cnt 0 my_set=set() my_set set() set mx_set=set() mx_set set() set for h_i, w_i in hw:
    if y_list[h_i-1]==my_cnt:
        my_set.add(h_i-1)
    if x_list[w_i-1]==mx_cnt:
        mx_set.add(w_i-1) h_i w_i hw if y_list[h_i-1]==my_cnt:
        my_set.add(h_i-1)
     y_list[h_i-1]==my_cnt y_list[h_i-1] y_list h_i-1 h_i 1 my_cnt my_set.add(h_i-1) my_set.add my_set add h_i-1 h_i 1 if x_list[w_i-1]==mx_cnt:
        mx_set.add(w_i-1) x_list[w_i-1]==mx_cnt x_list[w_i-1] x_list w_i-1 w_i 1 mx_cnt mx_set.add(w_i-1) mx_set.add mx_set add w_i-1 w_i 1 cnt=0 cnt 0 for h_i, w_i in hw:
    if y_list[h_i-1]==my_cnt and x_list[w_i-1]==mx_cnt:
        cnt+=1 h_i w_i hw if y_list[h_i-1]==my_cnt and x_list[w_i-1]==mx_cnt:
        cnt+=1 y_list[h_i-1]==my_cnt and x_list[w_i-1]==mx_cnt y_list[h_i-1]==my_cnt y_list[h_i-1] y_list h_i-1 h_i 1 my_cnt x_list[w_i-1]==mx_cnt x_list[w_i-1] x_list w_i-1 w_i 1 mx_cnt cnt+=1 cnt 1 print(my_cnt+mx_cnt-1 if cnt==len(my_set)*len(mx_set) else my_cnt+mx_cnt) print my_cnt+mx_cnt-1 if cnt==len(my_set)*len(mx_set) else my_cnt+mx_cnt cnt==len(my_set)*len(mx_set) cnt len(my_set)*len(mx_set) len(my_set) len my_set len(mx_set) len mx_set my_cnt+mx_cnt-1 my_cnt+mx_cnt my_cnt mx_cnt 1 my_cnt+mx_cnt my_cnt mx_cnt x_list=[0]*w [0]*w x_list hw=[list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] hw y_list=[0]*h [0]*h y_list mx_set=set() set() mx_set y_cnt=0 0 y_cnt x_cnt=0 0 x_cnt h,w,m=map(int, input().split()) map(int, input().split()) h my_cnt=max(y_list) max(y_list) my_cnt my_set=set() set() my_set w,m=map(int, input().split()) map(int, input().split()) w cnt=0 0 cnt m=map(int, input().split()) map(int, input().split()) m mx_cnt=max(x_list) max(x_list) mx_cnt cnt+=1 1 cnt
h,w,m=map(int, input().split())
hw=[list(map(int, input().split())) for _ in range(m)]

y_list=[0]*h
x_list=[0]*w

for h_i, w_i in hw:
    y_list[h_i-1]+=1
    x_list[w_i-1]+=1

my_cnt=max(y_list)
mx_cnt=max(x_list)

y_cnt=0
x_cnt=0

my_set=set()
mx_set=set()

for h_i, w_i in hw:
    if y_list[h_i-1]==my_cnt:
        my_set.add(h_i-1)
    if x_list[w_i-1]==mx_cnt:
        mx_set.add(w_i-1)

cnt=0
for h_i, w_i in hw:
    if y_list[h_i-1]==my_cnt and x_list[w_i-1]==mx_cnt:
        cnt+=1

print(my_cnt+mx_cnt-1 if cnt==len(my_set)*len(mx_set) else my_cnt+mx_cnt)
