import sys
input = sys.stdin.readline

h,w,m = map(int,input().split())

h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
    hi,wi = map( lambda x : int(x) - 1 , input().split() )
    h_array[hi] += 1
    w_array[wi] += 1
    ps.add( (hi,wi) )

h_great = max(h_array)
w_great = max(w_array)
h_greats = list()
w_greats = list()
for i , hi in enumerate(h_array):
    if hi == h_great:
        h_greats.append(i)
for i , wi in enumerate(w_array):
    if wi == w_great:
        w_greats.append(i)

ans = h_great + w_great


for _h in h_greats:
    for _w in w_greats:
        if (_h,_w) in ps:
            continue
        print(ans)
        exit()

print(ans-1) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m 0 for i in range(h) for i in range(h) i range(h) range h for i in range(h) 0 h_array = [ 0 for i in range(h) ] h_array [ 0 for i in range(h) ] 0 for i in range(w) for i in range(w) i range(w) range w for i in range(w) 0 w_array = [ 0 for i in range(w) ] w_array [ 0 for i in range(w) ] ps = set() ps set() set for i in range(m):
    hi,wi = map( lambda x : int(x) - 1 , input().split() )
    h_array[hi] += 1
    w_array[wi] += 1
    ps.add( (hi,wi) ) i range(m) range m hi,wi = map( lambda x : int(x) - 1 , input().split() ) hi map( lambda x : int(x) - 1 , input().split() ) map lambda x : int(x) - 1 int(x) - 1 int(x) int x 1 x input().split() ().split () input split wi h_array[hi] += 1 h_array[hi] h_array hi 1 w_array[wi] += 1 w_array[wi] w_array wi 1 ps.add( (hi,wi) ) ps.add ps add (hi,wi) hi wi h_great = max(h_array) h_great max(h_array) max h_array w_great = max(w_array) w_great max(w_array) max w_array h_greats = list() h_greats list() list w_greats = list() w_greats list() list for i , hi in enumerate(h_array):
    if hi == h_great:
        h_greats.append(i) i hi enumerate(h_array) enumerate h_array if hi == h_great:
        h_greats.append(i) hi == h_great hi h_great h_greats.append(i) h_greats.append h_greats append i for i , wi in enumerate(w_array):
    if wi == w_great:
        w_greats.append(i) i wi enumerate(w_array) enumerate w_array if wi == w_great:
        w_greats.append(i) wi == w_great wi w_great w_greats.append(i) w_greats.append w_greats append i ans = h_great + w_great ans h_great + w_great h_great w_great for _h in h_greats:
    for _w in w_greats:
        if (_h,_w) in ps:
            continue
        print(ans)
        exit() _h h_greats for _w in w_greats:
        if (_h,_w) in ps:
            continue
        print(ans)
        exit() _w w_greats if (_h,_w) in ps:
            continue
         (_h,_w) in ps (_h,_w) _h _w ps continue print(ans) print ans exit() exit print(ans-1) print ans-1 ans 1 hi,wi = map( lambda x : int(x) - 1 , input().split() ) map( lambda x : int(x) - 1 , input().split() ) hi h_array = [ 0 for i in range(h) ] [ 0 for i in range(h) ] h_array h_great = max(h_array) max(h_array) h_great ps = set() set() ps h_greats = list() list() h_greats w_array = [ 0 for i in range(w) ] [ 0 for i in range(w) ] w_array m = map(int,input().split()) map(int,input().split()) m w,m = map(int,input().split()) map(int,input().split()) w w_greats = list() list() w_greats input = sys.stdin.readline sys.stdin.readline input wi = map( lambda x : int(x) - 1 , input().split() ) map( lambda x : int(x) - 1 , input().split() ) wi w_great = max(w_array) max(w_array) w_great h,w,m = map(int,input().split()) map(int,input().split()) h ans = h_great + w_great h_great + w_great ans
import sys
input = sys.stdin.readline

h,w,m = map(int,input().split())

h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
    hi,wi = map( lambda x : int(x) - 1 , input().split() )
    h_array[hi] += 1
    w_array[wi] += 1
    ps.add( (hi,wi) )

h_great = max(h_array)
w_great = max(w_array)
h_greats = list()
w_greats = list()
for i , hi in enumerate(h_array):
    if hi == h_great:
        h_greats.append(i)
for i , wi in enumerate(w_array):
    if wi == w_great:
        w_greats.append(i)

ans = h_great + w_great


for _h in h_greats:
    for _w in w_greats:
        if (_h,_w) in ps:
            continue
        print(ans)
        exit()

print(ans-1)