import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque, defaultdict
from fractions import gcd
from functools import reduce
from itertools import groupby
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return list(map(lambda x: x + d, A))
def ldec(A, d=1): return list(map(lambda x: x - d, A))

H, W, M = nn()
T = nm(M)

for i in range(M):
    T[i] = ldec(T[i])

dh = array1(H)
dw = array1(W)

dic = {}

for i in range(M):
    dh[T[i][0]] += 1
    dw[T[i][1]] += 1
    dic[(T[i][0], T[i][1])] = True

dhlist = []
dwlist = []

ansh = max(dh)
for i in range(len(dh)):
    if dh[i] == ansh:
        dhlist.append(i)

answ = max(dw)
for i in range(len(dw)):
    if dw[i] == answ:
        dwlist.append(i)

ans = ansh + answ

for i in dhlist:
    for j in dwlist:
        if (i, j) not in dic:
            print(ans)
            exit(0)

print(ans-1) import sys, io, os, re sys io os re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import reduce from itertools import groupby from heapq import heapify, heappush, heappop n1 = lambda: int(sys.stdin.readline().strip()) n1 lambda: int(sys.stdin.readline().strip()) int(sys.stdin.readline().strip()) int sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip nn = lambda: list(map(int, sys.stdin.readline().strip().split())) nn lambda: list(map(int, sys.stdin.readline().strip().split())) list(map(int, sys.stdin.readline().strip().split())) list map(int, sys.stdin.readline().strip().split()) map int sys.stdin.readline().strip().split() sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split f1 = lambda: float(sys.stdin.readline().strip()) f1 lambda: float(sys.stdin.readline().strip()) float(sys.stdin.readline().strip()) float sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip fn = lambda: list(map(float, sys.stdin.readline().strip().split())) fn lambda: list(map(float, sys.stdin.readline().strip().split())) list(map(float, sys.stdin.readline().strip().split())) list map(float, sys.stdin.readline().strip().split()) map float sys.stdin.readline().strip().split() sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split s1 = lambda: sys.stdin.readline().strip() s1 lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip sn = lambda: list(sys.stdin.readline().strip().split()) sn lambda: list(sys.stdin.readline().strip().split()) list(sys.stdin.readline().strip().split()) list sys.stdin.readline().strip().split() sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split n1() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) n1() n1 nl = lambda n: [n1() for _ in range(n)] nl lambda n: [n1() for _ in range(n)] [n1() for _ in range(n)] n f1() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) f1() f1 fl = lambda n: [f1() for _ in range(n)] fl lambda n: [f1() for _ in range(n)] [f1() for _ in range(n)] n s1() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) s1() s1 sl = lambda n: [s1() for _ in range(n)] sl lambda n: [s1() for _ in range(n)] [s1() for _ in range(n)] n nn() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) nn() nn nm = lambda n: [nn() for _ in range(n)] nm lambda n: [nn() for _ in range(n)] [nn() for _ in range(n)] n fn() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) fn() fn fm = lambda n: [fn() for _ in range(n)] fm lambda n: [fn() for _ in range(n)] [fn() for _ in range(n)] n sn() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) sn() sn sm = lambda n: [sn() for _ in range(n)] sm lambda n: [sn() for _ in range(n)] [sn() for _ in range(n)] n def array1(n, d=0): return [d] * n array1 n n d=0 d 0 [d] * m for x in range(n) for x in range(n) x range(n) range n for x in range(n) [d] * m [d] d m def array2(n, m, d=0): return [[d] * m for x in range(n)] array2 n n m m d=0 d 0 [[d] * l for y in xrange(m)] for x in xrange(n) for x in xrange(n) x xrange(n) xrange n for x in xrange(n) [[d] * l for y in xrange(m)] def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)] array3 n n m m l l d=0 d 0 def linc(A, d=1): return list(map(lambda x: x + d, A)) linc A A d=1 d 1 def ldec(A, d=1): return list(map(lambda x: x - d, A)) ldec A A d=1 d 1 H, W, M = nn() H nn() nn W M T = nm(M) T nm(M) nm M for i in range(M):
    T[i] = ldec(T[i]) i range(M) range M T[i] = ldec(T[i]) T[i] T i ldec(T[i]) ldec T[i] T i dh = array1(H) dh array1(H) array1 H dw = array1(W) dw array1(W) array1 W dic = {} dic {} for i in range(M):
    dh[T[i][0]] += 1
    dw[T[i][1]] += 1
    dic[(T[i][0], T[i][1])] = True i range(M) range M dh[T[i][0]] += 1 dh[T[i][0]] dh T[i][0] [i] T i 0 1 dw[T[i][1]] += 1 dw[T[i][1]] dw T[i][1] [i] T i 1 1 dic[(T[i][0], T[i][1])] = True dic[(T[i][0], T[i][1])] dic (T[i][0], T[i][1]) T[i][0] [i] T i 0 T[i][1] [i] T i 1 True dhlist = [] dhlist [] dwlist = [] dwlist [] ansh = max(dh) ansh max(dh) max dh for i in range(len(dh)):
    if dh[i] == ansh:
        dhlist.append(i) i range(len(dh)) range len(dh) len dh if dh[i] == ansh:
        dhlist.append(i) dh[i] == ansh dh[i] dh i ansh dhlist.append(i) dhlist.append dhlist append i answ = max(dw) answ max(dw) max dw for i in range(len(dw)):
    if dw[i] == answ:
        dwlist.append(i) i range(len(dw)) range len(dw) len dw if dw[i] == answ:
        dwlist.append(i) dw[i] == answ dw[i] dw i answ dwlist.append(i) dwlist.append dwlist append i ans = ansh + answ ans ansh + answ ansh answ for i in dhlist:
    for j in dwlist:
        if (i, j) not in dic:
            print(ans)
            exit(0) i dhlist for j in dwlist:
        if (i, j) not in dic:
            print(ans)
            exit(0) j dwlist if (i, j) not in dic:
            print(ans)
            exit(0) (i, j) not in dic (i, j) i j dic print(ans) print ans exit(0) exit 0 print(ans-1) print ans-1 ans 1 fl = lambda n: [f1() for _ in range(n)] lambda n: [f1() for _ in range(n)] fl nn = lambda: list(map(int, sys.stdin.readline().strip().split())) lambda: list(map(int, sys.stdin.readline().strip().split())) nn nm = lambda n: [nn() for _ in range(n)] lambda n: [nn() for _ in range(n)] nm def array1(n, d=0): return [d] * n def array1(n, d=0): return [d] * n array1 answ = max(dw) max(dw) answ def array2(n, m, d=0): return [[d] * m for x in range(n)] def array2(n, m, d=0): return [[d] * m for x in range(n)] array2 s1 = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() s1 def linc(A, d=1): return list(map(lambda x: x + d, A)) def linc(A, d=1): return list(map(lambda x: x + d, A)) linc dw = array1(W) array1(W) dw f1 = lambda: float(sys.stdin.readline().strip()) lambda: float(sys.stdin.readline().strip()) f1 sl = lambda n: [s1() for _ in range(n)] lambda n: [s1() for _ in range(n)] sl ans = ansh + answ ansh + answ ans ansh = max(dh) max(dh) ansh sn = lambda: list(sys.stdin.readline().strip().split()) lambda: list(sys.stdin.readline().strip().split()) sn T = nm(M) nm(M) T fm = lambda n: [fn() for _ in range(n)] lambda n: [fn() for _ in range(n)] fm dic = {} {} dic H, W, M = nn() nn() H n1 = lambda: int(sys.stdin.readline().strip()) lambda: int(sys.stdin.readline().strip()) n1 dh = array1(H) array1(H) dh fn = lambda: list(map(float, sys.stdin.readline().strip().split())) lambda: list(map(float, sys.stdin.readline().strip().split())) fn M = nn() nn() M dhlist = [] [] dhlist def ldec(A, d=1): return list(map(lambda x: x - d, A)) def ldec(A, d=1): return list(map(lambda x: x - d, A)) ldec def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)] def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)] array3 W, M = nn() nn() W nl = lambda n: [n1() for _ in range(n)] lambda n: [n1() for _ in range(n)] nl sm = lambda n: [sn() for _ in range(n)] lambda n: [sn() for _ in range(n)] sm dwlist = [] [] dwlist
import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque, defaultdict
from fractions import gcd
from functools import reduce
from itertools import groupby
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return list(map(lambda x: x + d, A))
def ldec(A, d=1): return list(map(lambda x: x - d, A))

H, W, M = nn()
T = nm(M)

for i in range(M):
    T[i] = ldec(T[i])

dh = array1(H)
dw = array1(W)

dic = {}

for i in range(M):
    dh[T[i][0]] += 1
    dw[T[i][1]] += 1
    dic[(T[i][0], T[i][1])] = True

dhlist = []
dwlist = []

ansh = max(dh)
for i in range(len(dh)):
    if dh[i] == ansh:
        dhlist.append(i)

answ = max(dw)
for i in range(len(dw)):
    if dw[i] == answ:
        dwlist.append(i)

ans = ansh + answ

for i in dhlist:
    for j in dwlist:
        if (i, j) not in dic:
            print(ans)
            exit(0)

print(ans-1)
