from random import randint
import numpy as np
from numba import njit


@njit(cache=True)
def f(h,w,m,yp,xp,s):
    ypm = yp[:,0].max()
    xpm = xp[:,0].max()
    yps = yp[yp[:,0] == ypm][:,1]
    xps = xp[xp[:,0] == xpm][:,1]
    ans = 0
    for ypsi in yps:
        for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
    return ans


h,w,m = map(int,input().split())
s = set()
yp = np.zeros((h,2),dtype=np.int)
xp = np.zeros((w,2),dtype=np.int)
yp[:,1] = np.arange(h)
xp[:,1] = np.arange(w)
for i in range(m):
    hi,wi = map(int,input().split())
    s.add((hi-1,wi-1))
    yp[hi-1,0] += 1
    xp[wi-1,0] += 1
ans = f(h,w,m,yp,xp,s)
print(ans) from random import randint import numpy as np numpy from numba import njit def f(h,w,m,yp,xp,s):
    ypm = yp[:,0].max()
    xpm = xp[:,0].max()
    yps = yp[yp[:,0] == ypm][:,1]
    xps = xp[xp[:,0] == xpm][:,1]
    ans = 0
    for ypsi in yps:
        for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
    return ans f ypm = yp[:,0].max() ypm yp[:,0].max() [:,0].max [:,0] yp : max xpm = xp[:,0].max() xpm xp[:,0].max() [:,0].max [:,0] xp : max yps = yp[yp[:,0] == ypm][:,1] yps yp[yp[:,0] == ypm][:,1] [yp[:,0] == ypm] yp yp[:,0] == ypm yp[:,0] yp : ypm : xps = xp[xp[:,0] == xpm][:,1] xps xp[xp[:,0] == xpm][:,1] [xp[:,0] == xpm] xp xp[:,0] == xpm xp[:,0] xp : xpm : ans = 0 ans 0 for ypsi in yps:
        for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
     ypsi yps for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
     xpsi xps a = yp[ypsi,0]+xp[xpsi,0] a yp[ypsi,0]+xp[xpsi,0] yp[ypsi,0] yp ypsi xp[xpsi,0] xp xpsi if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
     (ypsi,xpsi) in s (ypsi,xpsi) ypsi xpsi s a -= 1 a 1 ans = max(ans,a) ans max(ans,a) max ans a return a a return ans ans h h w w m m yp yp xp xp s s @njit(cache=True) f cache=True @njit(cache=True) njit cache=True cache True f h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m s = set() s set() set yp = np.zeros((h,2),dtype=np.int) yp np.zeros((h,2),dtype=np.int) np.zeros np zeros (h,2) h 2 dtype=np.int dtype np.int np int xp = np.zeros((w,2),dtype=np.int) xp np.zeros((w,2),dtype=np.int) np.zeros np zeros (w,2) w 2 dtype=np.int dtype np.int np int yp[:,1] = np.arange(h) yp[:,1] yp : np.arange(h) np.arange np arange h xp[:,1] = np.arange(w) xp[:,1] xp : np.arange(w) np.arange np arange w for i in range(m):
    hi,wi = map(int,input().split())
    s.add((hi-1,wi-1))
    yp[hi-1,0] += 1
    xp[wi-1,0] += 1 i range(m) range m hi,wi = map(int,input().split()) hi map(int,input().split()) map int input().split() ().split () input split wi s.add((hi-1,wi-1)) s.add s add (hi-1,wi-1) hi-1 hi 1 wi-1 wi 1 yp[hi-1,0] += 1 yp[hi-1,0] yp hi-1 hi 1 1 xp[wi-1,0] += 1 xp[wi-1,0] xp wi-1 wi 1 1 ans = f(h,w,m,yp,xp,s) ans f(h,w,m,yp,xp,s) f h w m yp xp s print(ans) print ans h,w,m = map(int,input().split()) map(int,input().split()) h m = map(int,input().split()) map(int,input().split()) m wi = map(int,input().split()) map(int,input().split()) wi s = set() set() s yp = np.zeros((h,2),dtype=np.int) np.zeros((h,2),dtype=np.int) yp def f(h,w,m,yp,xp,s):
    ypm = yp[:,0].max()
    xpm = xp[:,0].max()
    yps = yp[yp[:,0] == ypm][:,1]
    xps = xp[xp[:,0] == xpm][:,1]
    ans = 0
    for ypsi in yps:
        for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
    return ans def f(h,w,m,yp,xp,s):
    ypm = yp[:,0].max()
    xpm = xp[:,0].max()
    yps = yp[yp[:,0] == ypm][:,1]
    xps = xp[xp[:,0] == xpm][:,1]
    ans = 0
    for ypsi in yps:
        for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
    return ans f w,m = map(int,input().split()) map(int,input().split()) w xp = np.zeros((w,2),dtype=np.int) np.zeros((w,2),dtype=np.int) xp hi,wi = map(int,input().split()) map(int,input().split()) hi ans = f(h,w,m,yp,xp,s) f(h,w,m,yp,xp,s) ans
from random import randint
import numpy as np
from numba import njit


@njit(cache=True)
def f(h,w,m,yp,xp,s):
    ypm = yp[:,0].max()
    xpm = xp[:,0].max()
    yps = yp[yp[:,0] == ypm][:,1]
    xps = xp[xp[:,0] == xpm][:,1]
    ans = 0
    for ypsi in yps:
        for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
    return ans


h,w,m = map(int,input().split())
s = set()
yp = np.zeros((h,2),dtype=np.int)
xp = np.zeros((w,2),dtype=np.int)
yp[:,1] = np.arange(h)
xp[:,1] = np.arange(w)
for i in range(m):
    hi,wi = map(int,input().split())
    s.add((hi-1,wi-1))
    yp[hi-1,0] += 1
    xp[wi-1,0] += 1
ans = f(h,w,m,yp,xp,s)
print(ans)
