import sys
input = sys.stdin.readline

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

    h_array = [ 0 for _ in range(h) ]
    w_array = [ 0 for _ 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)

if __name__ == '__main__':
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def main():
    h,w,m = map(int,input().split())

    h_array = [ 0 for _ in range(h) ]
    w_array = [ 0 for _ 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) main h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m 0 for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) 0 h_array = [ 0 for _ in range(h) ] h_array [ 0 for _ in range(h) ] 0 for _ in range(w) for _ in range(w) _ range(w) range w for _ in range(w) 0 w_array = [ 0 for _ in range(w) ] w_array [ 0 for _ 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 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main input = sys.stdin.readline sys.stdin.readline input def main():
    h,w,m = map(int,input().split())

    h_array = [ 0 for _ in range(h) ]
    w_array = [ 0 for _ 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) def main():
    h,w,m = map(int,input().split())

    h_array = [ 0 for _ in range(h) ]
    w_array = [ 0 for _ 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) main
import sys
input = sys.stdin.readline

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

    h_array = [ 0 for _ in range(h) ]
    w_array = [ 0 for _ 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)

if __name__ == '__main__':
    main()