import sys
import  math
import fractions
from collections import defaultdict
import heapq
from bisect import bisect_left,bisect

stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

H,W,M=nm()
r=[0]*(10**6)
c=[0]*(10**6)
mass=set()
for i in range(M):
    h,w=nm()
    mass.add(H*h+w)
    r[h]+=1
    c[w]+=1

rl=[]
cl=[]

r_max=0
for i in range(1,H+1):
    r_max=max(r[i],r_max)
    
c_max=0
for i in range(1,W+1):
    c_max=max(c[i],c_max)

for i in range(1,H+1):
    if(r[i]==r_max):
        rl.append(i)

for i in range(1,W+1):
    if(c[i]==c_max):
        cl.append(i)



for i in rl:
    for j in cl:
        if(i*H+j not in mass):
            print(r_max+c_max)
            sys.exit(0)


print(r_max+c_max-1) import sys sys import  math math import fractions fractions from collections import defaultdict import heapq heapq from bisect import bisect_left,bisect stdin = sys.stdin stdin sys.stdin sys stdin ns = lambda: stdin.readline().rstrip() ns lambda: stdin.readline().rstrip() stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip ni = lambda: int(stdin.readline().rstrip()) ni lambda: int(stdin.readline().rstrip()) int(stdin.readline().rstrip()) int stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip nm = lambda: map(int, stdin.readline().split()) nm lambda: map(int, stdin.readline().split()) map(int, stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split nl = lambda: list(map(int, stdin.readline().split())) nl lambda: list(map(int, stdin.readline().split())) list(map(int, stdin.readline().split())) list map(int, stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split H,W,M=nm() H nm() nm W M r=[0]*(10**6) r [0]*(10**6) [0] 0 10**6 10 6 c=[0]*(10**6) c [0]*(10**6) [0] 0 10**6 10 6 mass=set() mass set() set for i in range(M):
    h,w=nm()
    mass.add(H*h+w)
    r[h]+=1
    c[w]+=1 i range(M) range M h,w=nm() h nm() nm w mass.add(H*h+w) mass.add mass add H*h+w H*h H h w r[h]+=1 r[h] r h 1 c[w]+=1 c[w] c w 1 rl=[] rl [] cl=[] cl [] r_max=0 r_max 0 for i in range(1,H+1):
    r_max=max(r[i],r_max)
     i range(1,H+1) range 1 H+1 H 1 r_max=max(r[i],r_max) r_max max(r[i],r_max) max r[i] r i r_max c_max=0 c_max 0 for i in range(1,W+1):
    c_max=max(c[i],c_max) i range(1,W+1) range 1 W+1 W 1 c_max=max(c[i],c_max) c_max max(c[i],c_max) max c[i] c i c_max for i in range(1,H+1):
    if(r[i]==r_max):
        rl.append(i) i range(1,H+1) range 1 H+1 H 1 if(r[i]==r_max):
        rl.append(i) r[i]==r_max r[i] r i r_max rl.append(i) rl.append rl append i for i in range(1,W+1):
    if(c[i]==c_max):
        cl.append(i) i range(1,W+1) range 1 W+1 W 1 if(c[i]==c_max):
        cl.append(i) c[i]==c_max c[i] c i c_max cl.append(i) cl.append cl append i for i in rl:
    for j in cl:
        if(i*H+j not in mass):
            print(r_max+c_max)
            sys.exit(0) i rl for j in cl:
        if(i*H+j not in mass):
            print(r_max+c_max)
            sys.exit(0) j cl if(i*H+j not in mass):
            print(r_max+c_max)
            sys.exit(0) i*H+j not in mass i*H+j i*H i H j mass print(r_max+c_max) print r_max+c_max r_max c_max sys.exit(0) sys.exit sys exit 0 print(r_max+c_max-1) print r_max+c_max-1 r_max+c_max r_max c_max 1 stdin = sys.stdin sys.stdin stdin H,W,M=nm() nm() H ns = lambda: stdin.readline().rstrip() lambda: stdin.readline().rstrip() ns r_max=0 0 r_max W,M=nm() nm() W nl = lambda: list(map(int, stdin.readline().split())) lambda: list(map(int, stdin.readline().split())) nl c_max=0 0 c_max M=nm() nm() M r=[0]*(10**6) [0]*(10**6) r mass=set() set() mass ni = lambda: int(stdin.readline().rstrip()) lambda: int(stdin.readline().rstrip()) ni nm = lambda: map(int, stdin.readline().split()) lambda: map(int, stdin.readline().split()) nm cl=[] [] cl c=[0]*(10**6) [0]*(10**6) c r_max=max(r[i],r_max) max(r[i],r_max) r_max h,w=nm() nm() h w=nm() nm() w rl=[] [] rl c_max=max(c[i],c_max) max(c[i],c_max) c_max
import sys
import  math
import fractions
from collections import defaultdict
import heapq
from bisect import bisect_left,bisect

stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

H,W,M=nm()
r=[0]*(10**6)
c=[0]*(10**6)
mass=set()
for i in range(M):
    h,w=nm()
    mass.add(H*h+w)
    r[h]+=1
    c[w]+=1

rl=[]
cl=[]

r_max=0
for i in range(1,H+1):
    r_max=max(r[i],r_max)
    
c_max=0
for i in range(1,W+1):
    c_max=max(c[i],c_max)

for i in range(1,H+1):
    if(r[i]==r_max):
        rl.append(i)

for i in range(1,W+1):
    if(c[i]==c_max):
        cl.append(i)



for i in rl:
    for j in cl:
        if(i*H+j not in mass):
            print(r_max+c_max)
            sys.exit(0)


print(r_max+c_max-1)
