import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

h,w,m = (int(x) for x in input().split())
rows = [[0,i] for i in xrange(h)]
cols = [[0,i] for i in xrange(w)]
bomb_dict = dict()
for i in xrange(m):
    hi,wi = (int(x)-1 for x in input().split())
    rows[hi][0] += 1
    cols[wi][0] += 1
    bomb_dict[(hi,wi)] = True

rows = sorted(rows, reverse=True)
cols = sorted(cols, reverse=True)
# print(cols)
ans = 1
for row in rows:
    ans_ans = None
    for col in cols:
        getr = bomb_dict.get((row[1], col[1]), False)
        if getr and ans_ans is None:
            ans_ans = row[0] + col[0] - 1
            # print("1",row[0],col[0], -1)
            best_ans = ans_ans
        elif getr and row[0] + col[0]-1 < ans_ans:
            best_ans = ans_ans
            break
        elif getr:
            pass
        else:
            if ans_ans is None:
                best_ans = row[0] + col[0]
                # print("2",row,col, best_ans)
            else:
                best_ans = max(row[0] + col[0], ans_ans)
                # print("3",row[0],col[0])
            break
    if best_ans > ans:
        ans = best_ans
    if best_ans < ans:
        break
    
print(ans) import os os import sys sys from atexit import register from io import BytesIO sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size)) sys.stdin sys stdin BytesIO(os.read(0, os.fstat(0).st_size)) BytesIO os.read(0, os.fstat(0).st_size) os.read os read 0 os.fstat(0).st_size os.fstat(0) os.fstat os fstat 0 st_size sys.stdout = BytesIO() sys.stdout sys stdout BytesIO() BytesIO register(lambda: os.write(1, sys.stdout.getvalue())) register lambda: os.write(1, sys.stdout.getvalue()) os.write(1, sys.stdout.getvalue()) os.write os write 1 sys.stdout.getvalue() sys.stdout.getvalue sys.stdout sys stdout getvalue input = lambda: sys.stdin.readline().rstrip('\r\n') input lambda: sys.stdin.readline().rstrip('\r\n') sys.stdin.readline().rstrip('\r\n') sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip '\r\n' raw_input = lambda: sys.stdin.readline().rstrip('\r\n') raw_input lambda: sys.stdin.readline().rstrip('\r\n') sys.stdin.readline().rstrip('\r\n') sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip '\r\n' int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x h,w,m = (int(x) for x in input().split()) h (int(x) for x in input().split()) w m [0,i] for i in xrange(h) for i in xrange(h) i xrange(h) xrange h for i in xrange(h) [0,i] 0 i rows = [[0,i] for i in xrange(h)] rows [[0,i] for i in xrange(h)] [0,i] for i in xrange(w) for i in xrange(w) i xrange(w) xrange w for i in xrange(w) [0,i] 0 i cols = [[0,i] for i in xrange(w)] cols [[0,i] for i in xrange(w)] bomb_dict = dict() bomb_dict dict() dict for i in xrange(m):
    hi,wi = (int(x)-1 for x in input().split())
    rows[hi][0] += 1
    cols[wi][0] += 1
    bomb_dict[(hi,wi)] = True i xrange(m) xrange m int(x)-1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x)-1 int(x) int x 1 hi,wi = (int(x)-1 for x in input().split()) hi (int(x)-1 for x in input().split()) wi rows[hi][0] += 1 rows[hi][0] [hi] rows hi 0 1 cols[wi][0] += 1 cols[wi][0] [wi] cols wi 0 1 bomb_dict[(hi,wi)] = True bomb_dict[(hi,wi)] bomb_dict (hi,wi) hi wi True rows = sorted(rows, reverse=True) rows sorted(rows, reverse=True) sorted rows reverse=True reverse True cols = sorted(cols, reverse=True) cols sorted(cols, reverse=True) sorted cols reverse=True reverse True ans = 1 ans 1 for row in rows:
    ans_ans = None
    for col in cols:
        getr = bomb_dict.get((row[1], col[1]), False)
        if getr and ans_ans is None:
            ans_ans = row[0] + col[0] - 1
            # print("1",row[0],col[0], -1)
            best_ans = ans_ans
        elif getr and row[0] + col[0]-1 < ans_ans:
            best_ans = ans_ans
            break
        elif getr:
            pass
        else:
            if ans_ans is None:
                best_ans = row[0] + col[0]
                # print("2",row,col, best_ans)
            else:
                best_ans = max(row[0] + col[0], ans_ans)
                # print("3",row[0],col[0])
            break
    if best_ans > ans:
        ans = best_ans
    if best_ans < ans:
        break
     row rows ans_ans = None ans_ans None for col in cols:
        getr = bomb_dict.get((row[1], col[1]), False)
        if getr and ans_ans is None:
            ans_ans = row[0] + col[0] - 1
            # print("1",row[0],col[0], -1)
            best_ans = ans_ans
        elif getr and row[0] + col[0]-1 < ans_ans:
            best_ans = ans_ans
            break
        elif getr:
            pass
        else:
            if ans_ans is None:
                best_ans = row[0] + col[0]
                # print("2",row,col, best_ans)
            else:
                best_ans = max(row[0] + col[0], ans_ans)
                # print("3",row[0],col[0])
            break
     col cols getr = bomb_dict.get((row[1], col[1]), False) getr bomb_dict.get((row[1], col[1]), False) bomb_dict.get bomb_dict get (row[1], col[1]) row[1] row 1 col[1] col 1 False if getr and ans_ans is None:
            ans_ans = row[0] + col[0] - 1
            # print("1",row[0],col[0], -1)
            best_ans = ans_ans
        elif getr and row[0] + col[0]-1 < ans_ans:
            best_ans = ans_ans
            break
        elif getr:
            pass
        else:
            if ans_ans is None:
                best_ans = row[0] + col[0]
                # print("2",row,col, best_ans)
            else:
                best_ans = max(row[0] + col[0], ans_ans)
                # print("3",row[0],col[0])
            break
     getr and ans_ans is None getr ans_ans is None ans_ans None ans_ans = row[0] + col[0] - 1 ans_ans row[0] + col[0] - 1 row[0] + col[0] row[0] row 0 col[0] col 0 1 best_ans = ans_ans best_ans ans_ans elif getr and row[0] + col[0]-1 < ans_ans:
            best_ans = ans_ans
            break
         getr and row[0] + col[0]-1 < ans_ans getr row[0] + col[0]-1 < ans_ans row[0] + col[0]-1 row[0] + col[0] row[0] row 0 col[0] col 0 1 ans_ans best_ans = ans_ans best_ans ans_ans break elif getr:
            pass
         getr if ans_ans is None:
                best_ans = row[0] + col[0]
                # print("2",row,col, best_ans)
            else:
                best_ans = max(row[0] + col[0], ans_ans)
                # print("3",row[0],col[0])
             ans_ans is None ans_ans None best_ans = row[0] + col[0] best_ans row[0] + col[0] row[0] row 0 col[0] col 0 best_ans = max(row[0] + col[0], ans_ans) best_ans max(row[0] + col[0], ans_ans) max row[0] + col[0] row[0] row 0 col[0] col 0 ans_ans break if best_ans > ans:
        ans = best_ans
     best_ans > ans best_ans ans ans = best_ans ans best_ans if best_ans < ans:
        break
     best_ans < ans best_ans ans break print(ans) print ans ans = 1 1 ans best_ans = ans_ans ans_ans best_ans raw_input = lambda: sys.stdin.readline().rstrip('\r\n') lambda: sys.stdin.readline().rstrip('\r\n') raw_input h,w,m = (int(x) for x in input().split()) (int(x) for x in input().split()) h w,m = (int(x) for x in input().split()) (int(x) for x in input().split()) w ans = best_ans best_ans ans input = lambda: sys.stdin.readline().rstrip('\r\n') lambda: sys.stdin.readline().rstrip('\r\n') input rows = [[0,i] for i in xrange(h)] [[0,i] for i in xrange(h)] rows getr = bomb_dict.get((row[1], col[1]), False) bomb_dict.get((row[1], col[1]), False) getr rows = sorted(rows, reverse=True) sorted(rows, reverse=True) rows best_ans = row[0] + col[0] row[0] + col[0] best_ans best_ans = max(row[0] + col[0], ans_ans) max(row[0] + col[0], ans_ans) best_ans best_ans = ans_ans ans_ans best_ans hi,wi = (int(x)-1 for x in input().split()) (int(x)-1 for x in input().split()) hi cols = sorted(cols, reverse=True) sorted(cols, reverse=True) cols cols = [[0,i] for i in xrange(w)] [[0,i] for i in xrange(w)] cols wi = (int(x)-1 for x in input().split()) (int(x)-1 for x in input().split()) wi ans_ans = None None ans_ans m = (int(x) for x in input().split()) (int(x) for x in input().split()) m bomb_dict = dict() dict() bomb_dict ans_ans = row[0] + col[0] - 1 row[0] + col[0] - 1 ans_ans
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

h,w,m = (int(x) for x in input().split())
rows = [[0,i] for i in xrange(h)]
cols = [[0,i] for i in xrange(w)]
bomb_dict = dict()
for i in xrange(m):
    hi,wi = (int(x)-1 for x in input().split())
    rows[hi][0] += 1
    cols[wi][0] += 1
    bomb_dict[(hi,wi)] = True

rows = sorted(rows, reverse=True)
cols = sorted(cols, reverse=True)
# print(cols)
ans = 1
for row in rows:
    ans_ans = None
    for col in cols:
        getr = bomb_dict.get((row[1], col[1]), False)
        if getr and ans_ans is None:
            ans_ans = row[0] + col[0] - 1
            # print("1",row[0],col[0], -1)
            best_ans = ans_ans
        elif getr and row[0] + col[0]-1 < ans_ans:
            best_ans = ans_ans
            break
        elif getr:
            pass
        else:
            if ans_ans is None:
                best_ans = row[0] + col[0]
                # print("2",row,col, best_ans)
            else:
                best_ans = max(row[0] + col[0], ans_ans)
                # print("3",row[0],col[0])
            break
    if best_ans > ans:
        ans = best_ans
    if best_ans < ans:
        break
    
print(ans)
