import sys
h,w,m = map(int,input().split())
hight = [0]*h
width = [0]*w
S = set()

for i in range(m):
    hi,wi = map(int,input().split())
    S.add((hi-1,wi-1))
    hight[hi-1] += 1
    width[wi-1] += 1

max_vh = max(hight)
max_vw = max(width)

max_h = [i for i in range(h) if hight[i] == max_vh]
max_w = [i for i in range(w) if width[i] == max_vw]
for i in max_h:
    for j in max_w:
        if not(i,j) in S:
            print(max_vh+max_vw)
            sys.exit()

print(max_vh+max_vw-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 hight = [0]*h hight [0]*h [0] 0 h width = [0]*w width [0]*w [0] 0 w S = set() S set() set for i in range(m):
    hi,wi = map(int,input().split())
    S.add((hi-1,wi-1))
    hight[hi-1] += 1
    width[wi-1] += 1 i range(m) range m hi,wi = map(int,input().split()) hi map(int,input().split()) map int input().split() ().split () input split wi S.add((hi-1,wi-1)) S.add S add (hi-1,wi-1) hi-1 hi 1 wi-1 wi 1 hight[hi-1] += 1 hight[hi-1] hight hi-1 hi 1 1 width[wi-1] += 1 width[wi-1] width wi-1 wi 1 1 max_vh = max(hight) max_vh max(hight) max hight max_vw = max(width) max_vw max(width) max width i for i in range(h) if hight[i] == max_vh for i in range(h) if hight[i] == max_vh i range(h) range h hight[i] == max_vh hight[i] hight i max_vh if hight[i] == max_vh i max_h = [i for i in range(h) if hight[i] == max_vh] max_h [i for i in range(h) if hight[i] == max_vh] i for i in range(w) if width[i] == max_vw for i in range(w) if width[i] == max_vw i range(w) range w width[i] == max_vw width[i] width i max_vw if width[i] == max_vw i max_w = [i for i in range(w) if width[i] == max_vw] max_w [i for i in range(w) if width[i] == max_vw] for i in max_h:
    for j in max_w:
        if not(i,j) in S:
            print(max_vh+max_vw)
            sys.exit() i max_h for j in max_w:
        if not(i,j) in S:
            print(max_vh+max_vw)
            sys.exit() j max_w if not(i,j) in S:
            print(max_vh+max_vw)
            sys.exit() not(i,j) in S (i,j) in S (i,j) i j S print(max_vh+max_vw) print max_vh+max_vw max_vh max_vw sys.exit() sys.exit sys exit print(max_vh+max_vw-1) print max_vh+max_vw-1 max_vh+max_vw max_vh max_vw 1 w,m = map(int,input().split()) map(int,input().split()) w hight = [0]*h [0]*h hight S = set() set() S wi = map(int,input().split()) map(int,input().split()) wi max_h = [i for i in range(h) if hight[i] == max_vh] [i for i in range(h) if hight[i] == max_vh] max_h m = map(int,input().split()) map(int,input().split()) m h,w,m = map(int,input().split()) map(int,input().split()) h width = [0]*w [0]*w width hi,wi = map(int,input().split()) map(int,input().split()) hi max_vw = max(width) max(width) max_vw max_vh = max(hight) max(hight) max_vh max_w = [i for i in range(w) if width[i] == max_vw] [i for i in range(w) if width[i] == max_vw] max_w
import sys
h,w,m = map(int,input().split())
hight = [0]*h
width = [0]*w
S = set()

for i in range(m):
    hi,wi = map(int,input().split())
    S.add((hi-1,wi-1))
    hight[hi-1] += 1
    width[wi-1] += 1

max_vh = max(hight)
max_vw = max(width)

max_h = [i for i in range(h) if hight[i] == max_vh]
max_w = [i for i in range(w) if width[i] == max_vw]
for i in max_h:
    for j in max_w:
        if not(i,j) in S:
            print(max_vh+max_vw)
            sys.exit()

print(max_vh+max_vw-1)

