from collections import deque,defaultdict
import heapq as hp
def solve():
    h,w,m=map(int,input().strip().split(" "))
    dr=defaultdict(int)
    dc=defaultdict(int)
    s=set()
    for _ in range(m):
        a,b=map(int,input().strip().split(" "))
        dr[a]+=1
        dc[b]+=1
        s.add((a,b))

    kr=max(dr.values())
    kc=max(dc.values())
    rs=[]
    cs=[]
    rs+=[i for i in dr.keys() if dr[i]==kr ]
    cs+=[i for i in dc.keys() if dc[i]==kc ]
    for i in rs:
        for j in cs:
            if (i,j) not in s:
                print(kr+kc)
                exit()

    print(kr+kc-1)






solve() from collections import deque,defaultdict import heapq as hp heapq def solve():
    h,w,m=map(int,input().strip().split(" "))
    dr=defaultdict(int)
    dc=defaultdict(int)
    s=set()
    for _ in range(m):
        a,b=map(int,input().strip().split(" "))
        dr[a]+=1
        dc[b]+=1
        s.add((a,b))

    kr=max(dr.values())
    kc=max(dc.values())
    rs=[]
    cs=[]
    rs+=[i for i in dr.keys() if dr[i]==kr ]
    cs+=[i for i in dc.keys() if dc[i]==kc ]
    for i in rs:
        for j in cs:
            if (i,j) not in s:
                print(kr+kc)
                exit()

    print(kr+kc-1) solve h,w,m=map(int,input().strip().split(" ")) h map(int,input().strip().split(" ")) map int input().strip().split(" ") ().strip().split ().strip() ().strip () input strip split " " w m dr=defaultdict(int) dr defaultdict(int) defaultdict int dc=defaultdict(int) dc defaultdict(int) defaultdict int s=set() s set() set for _ in range(m):
        a,b=map(int,input().strip().split(" "))
        dr[a]+=1
        dc[b]+=1
        s.add((a,b))

     _ range(m) range m a,b=map(int,input().strip().split(" ")) a map(int,input().strip().split(" ")) map int input().strip().split(" ") ().strip().split ().strip() ().strip () input strip split " " b dr[a]+=1 dr[a] dr a 1 dc[b]+=1 dc[b] dc b 1 s.add((a,b)) s.add s add (a,b) a b kr=max(dr.values()) kr max(dr.values()) max dr.values() dr.values dr values kc=max(dc.values()) kc max(dc.values()) max dc.values() dc.values dc values rs=[] rs [] cs=[] cs [] i for i in dr.keys() if dr[i]==kr for i in dr.keys() if dr[i]==kr i dr.keys() dr.keys dr keys dr[i]==kr dr[i] dr i kr if dr[i]==kr i rs+=[i for i in dr.keys() if dr[i]==kr ] rs [i for i in dr.keys() if dr[i]==kr ] i for i in dc.keys() if dc[i]==kc for i in dc.keys() if dc[i]==kc i dc.keys() dc.keys dc keys dc[i]==kc dc[i] dc i kc if dc[i]==kc i cs+=[i for i in dc.keys() if dc[i]==kc ] cs [i for i in dc.keys() if dc[i]==kc ] for i in rs:
        for j in cs:
            if (i,j) not in s:
                print(kr+kc)
                exit()

     i rs for j in cs:
            if (i,j) not in s:
                print(kr+kc)
                exit()

     j cs if (i,j) not in s:
                print(kr+kc)
                exit()

     (i,j) not in s (i,j) i j s print(kr+kc) print kr+kc kr kc exit() exit print(kr+kc-1) print kr+kc-1 kr+kc kr kc 1 solve() solve def solve():
    h,w,m=map(int,input().strip().split(" "))
    dr=defaultdict(int)
    dc=defaultdict(int)
    s=set()
    for _ in range(m):
        a,b=map(int,input().strip().split(" "))
        dr[a]+=1
        dc[b]+=1
        s.add((a,b))

    kr=max(dr.values())
    kc=max(dc.values())
    rs=[]
    cs=[]
    rs+=[i for i in dr.keys() if dr[i]==kr ]
    cs+=[i for i in dc.keys() if dc[i]==kc ]
    for i in rs:
        for j in cs:
            if (i,j) not in s:
                print(kr+kc)
                exit()

    print(kr+kc-1) def solve():
    h,w,m=map(int,input().strip().split(" "))
    dr=defaultdict(int)
    dc=defaultdict(int)
    s=set()
    for _ in range(m):
        a,b=map(int,input().strip().split(" "))
        dr[a]+=1
        dc[b]+=1
        s.add((a,b))

    kr=max(dr.values())
    kc=max(dc.values())
    rs=[]
    cs=[]
    rs+=[i for i in dr.keys() if dr[i]==kr ]
    cs+=[i for i in dc.keys() if dc[i]==kc ]
    for i in rs:
        for j in cs:
            if (i,j) not in s:
                print(kr+kc)
                exit()

    print(kr+kc-1) solve
from collections import deque,defaultdict
import heapq as hp
def solve():
    h,w,m=map(int,input().strip().split(" "))
    dr=defaultdict(int)
    dc=defaultdict(int)
    s=set()
    for _ in range(m):
        a,b=map(int,input().strip().split(" "))
        dr[a]+=1
        dc[b]+=1
        s.add((a,b))

    kr=max(dr.values())
    kc=max(dc.values())
    rs=[]
    cs=[]
    rs+=[i for i in dr.keys() if dr[i]==kr ]
    cs+=[i for i in dc.keys() if dc[i]==kc ]
    for i in rs:
        for j in cs:
            if (i,j) not in s:
                print(kr+kc)
                exit()

    print(kr+kc-1)






solve()
