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)
row_val = rows[0][0]
col_val = cols[0][0]
ans = None
for row in rows:
    if row[0] != row_val:
        break
    for col in cols:
        if col[0] != col_val:
            break
        getr = bomb_dict.get((row[1], col[1]), False)
        if not getr:
            ans = row_val + col_val
            break
    
    if ans:
        break

if ans is None:
    ans = row_val + col_val - 1
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 row_val = rows[0][0] row_val rows[0][0] [0] rows 0 0 col_val = cols[0][0] col_val cols[0][0] [0] cols 0 0 ans = None ans None for row in rows:
    if row[0] != row_val:
        break
    for col in cols:
        if col[0] != col_val:
            break
        getr = bomb_dict.get((row[1], col[1]), False)
        if not getr:
            ans = row_val + col_val
            break
    
    if ans:
        break row rows if row[0] != row_val:
        break
     row[0] != row_val row[0] row 0 row_val break for col in cols:
        if col[0] != col_val:
            break
        getr = bomb_dict.get((row[1], col[1]), False)
        if not getr:
            ans = row_val + col_val
            break
    
     col cols if col[0] != col_val:
            break
         col[0] != col_val col[0] col 0 col_val break 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 not getr:
            ans = row_val + col_val
            break
    
     not getr getr ans = row_val + col_val ans row_val + col_val row_val col_val break if ans:
        break ans break if ans is None:
    ans = row_val + col_val - 1 ans is None ans None ans = row_val + col_val - 1 ans row_val + col_val - 1 row_val + col_val row_val col_val 1 print(ans) print ans raw_input = lambda: sys.stdin.readline().rstrip('\r\n') lambda: sys.stdin.readline().rstrip('\r\n') raw_input row_val = rows[0][0] rows[0][0] row_val input = lambda: sys.stdin.readline().rstrip('\r\n') lambda: sys.stdin.readline().rstrip('\r\n') input hi,wi = (int(x)-1 for x in input().split()) (int(x)-1 for x in input().split()) hi getr = bomb_dict.get((row[1], col[1]), False) bomb_dict.get((row[1], col[1]), False) getr wi = (int(x)-1 for x in input().split()) (int(x)-1 for x in input().split()) wi cols = [[0,i] for i in xrange(w)] [[0,i] for i in xrange(w)] cols ans = row_val + col_val row_val + col_val ans rows = [[0,i] for i in xrange(h)] [[0,i] for i in xrange(h)] rows bomb_dict = dict() dict() bomb_dict rows = sorted(rows, reverse=True) sorted(rows, reverse=True) rows col_val = cols[0][0] cols[0][0] col_val ans = row_val + col_val - 1 row_val + col_val - 1 ans h,w,m = (int(x) for x in input().split()) (int(x) for x in input().split()) h cols = sorted(cols, reverse=True) sorted(cols, reverse=True) cols m = (int(x) for x in input().split()) (int(x) for x in input().split()) m ans = None None ans w,m = (int(x) for x in input().split()) (int(x) for x in input().split()) w
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)
row_val = rows[0][0]
col_val = cols[0][0]
ans = None
for row in rows:
    if row[0] != row_val:
        break
    for col in cols:
        if col[0] != col_val:
            break
        getr = bomb_dict.get((row[1], col[1]), False)
        if not getr:
            ans = row_val + col_val
            break
    
    if ans:
        break

if ans is None:
    ans = row_val + col_val - 1
print(ans)
