import sys
H,W,m = map(int, input().split())

high = [0] * H
width = [0] * W

stone = set()
for i in range(m):
    h, w = map(int,input().split())
    h -= 1
    w -= 1
    
    high[h] += 1
    width[w] += 1
    stone.add((h,w))
    
dic_h = {}
for i in range(len(high)):
    dic_h.setdefault(high[i], [])
    
    dic_h[high[i]].append(i)
    
dic_w = {}
for i in range(len(width)):
    dic_w.setdefault(width[i], [])
    
    dic_w[width[i]].append(i)
    
h_max = max(dic_h.keys())
w_max = max(dic_w.keys())

for i in dic_h[h_max]:
    for j in dic_w[w_max]:
        if (i,j) not in stone:
            print(h_max+w_max)
            sys.exit(0)
            
print(h_max+w_max-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 high = [0] * H high [0] * H [0] 0 H width = [0] * W width [0] * W [0] 0 W stone = set() stone set() set for i in range(m):
    h, w = map(int,input().split())
    h -= 1
    w -= 1
    
    high[h] += 1
    width[w] += 1
    stone.add((h,w))
     i range(m) range m h, w = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w h -= 1 h 1 w -= 1 w 1 high[h] += 1 high[h] high h 1 width[w] += 1 width[w] width w 1 stone.add((h,w)) stone.add stone add (h,w) h w dic_h = {} dic_h {} for i in range(len(high)):
    dic_h.setdefault(high[i], [])
    
    dic_h[high[i]].append(i)
     i range(len(high)) range len(high) len high dic_h.setdefault(high[i], []) dic_h.setdefault dic_h setdefault high[i] high i [] dic_h[high[i]].append(i) [high[i]].append [high[i]] dic_h high[i] high i append i dic_w = {} dic_w {} for i in range(len(width)):
    dic_w.setdefault(width[i], [])
    
    dic_w[width[i]].append(i)
     i range(len(width)) range len(width) len width dic_w.setdefault(width[i], []) dic_w.setdefault dic_w setdefault width[i] width i [] dic_w[width[i]].append(i) [width[i]].append [width[i]] dic_w width[i] width i append i h_max = max(dic_h.keys()) h_max max(dic_h.keys()) max dic_h.keys() dic_h.keys dic_h keys w_max = max(dic_w.keys()) w_max max(dic_w.keys()) max dic_w.keys() dic_w.keys dic_w keys for i in dic_h[h_max]:
    for j in dic_w[w_max]:
        if (i,j) not in stone:
            print(h_max+w_max)
            sys.exit(0)
             i dic_h[h_max] dic_h h_max for j in dic_w[w_max]:
        if (i,j) not in stone:
            print(h_max+w_max)
            sys.exit(0)
             j dic_w[w_max] dic_w w_max if (i,j) not in stone:
            print(h_max+w_max)
            sys.exit(0)
             (i,j) not in stone (i,j) i j stone print(h_max+w_max) print h_max+w_max h_max w_max sys.exit(0) sys.exit sys exit 0 print(h_max+w_max-1) print h_max+w_max-1 h_max+w_max h_max w_max 1 W,m = map(int, input().split()) map(int, input().split()) W stone = set() set() stone w_max = max(dic_w.keys()) max(dic_w.keys()) w_max h -= 1 1 h dic_h = {} {} dic_h w = map(int,input().split()) map(int,input().split()) w H,W,m = map(int, input().split()) map(int, input().split()) H m = map(int, input().split()) map(int, input().split()) m dic_w = {} {} dic_w high = [0] * H [0] * H high h_max = max(dic_h.keys()) max(dic_h.keys()) h_max h, w = map(int,input().split()) map(int,input().split()) h width = [0] * W [0] * W width w -= 1 1 w
import sys
H,W,m = map(int, input().split())

high = [0] * H
width = [0] * W

stone = set()
for i in range(m):
    h, w = map(int,input().split())
    h -= 1
    w -= 1
    
    high[h] += 1
    width[w] += 1
    stone.add((h,w))
    
dic_h = {}
for i in range(len(high)):
    dic_h.setdefault(high[i], [])
    
    dic_h[high[i]].append(i)
    
dic_w = {}
for i in range(len(width)):
    dic_w.setdefault(width[i], [])
    
    dic_w[width[i]].append(i)
    
h_max = max(dic_h.keys())
w_max = max(dic_w.keys())

for i in dic_h[h_max]:
    for j in dic_w[w_max]:
        if (i,j) not in stone:
            print(h_max+w_max)
            sys.exit(0)
            
print(h_max+w_max-1)