#-------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# ------------------- fast io --------------------

from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi

def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y


h, w, m = map(int, input().split())
rs = [0] * h
cs = [0] * w

se = set()
for i in range(m):
    r, c =  map(int, input().split())
    rs[r - 1] += 1
    cs[c - 1] += 1
    se.add((r - 1) * w + c - 1)

rmax = max(rs)
cmax = max(cs)

remax = rs.count(rmax)
cemax = cs.count(cmax)
if remax * cemax > m:
    print(rmax + cmax)
    sys.exit(0)

rmaxs = [i for i, _ in enumerate(rs) if _ == rmax]
cmaxs = [i for i, _ in enumerate(cs) if _ == cmax]
for r in rmaxs:
    for c in cmaxs:
        if r * w + c not in se:
            print(rmax + cmax)
            sys.exit(0)

print(rmax + cmax - 1) import os os import sys sys from io import BytesIO, IOBase BUFSIZE = 8192 BUFSIZE 8192 class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
  FastIO newlines = 0 newlines 0 def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
     __init__ self._fd = file.fileno() self._fd self _fd file.fileno() file.fileno file fileno self.buffer = BytesIO() self.buffer self buffer BytesIO() BytesIO self.writable = "x" in file.mode or "r" not in file.mode self.writable self writable "x" in file.mode or "r" not in file.mode "x" in file.mode "x" file.mode file mode "r" not in file.mode "r" file.mode file mode self.write = self.buffer.write if self.writable else None self.write self write self.buffer.write if self.writable else None self.writable self writable self.buffer.write self.buffer self buffer write None self self file file def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
     read while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
         True b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) b os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) os.read os read self._fd self _fd max(os.fstat(self._fd).st_size, BUFSIZE) max os.fstat(self._fd).st_size os.fstat(self._fd) os.fstat os fstat self._fd self _fd st_size BUFSIZE if not b:
                break
             not b b break ptr = self.buffer.tell() ptr self.buffer.tell() self.buffer.tell self.buffer self buffer tell self.buffer.seek(0, 2) self.buffer.seek self.buffer self buffer seek 0 2 self.buffer.write(b) self.buffer.write self.buffer self buffer write b self.buffer.seek(ptr) self.buffer.seek self.buffer self buffer seek ptr self.newlines = 0 self.newlines self newlines 0 return self.buffer.read() self.buffer.read() self.buffer.read self.buffer self buffer read self self def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
     readline while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
         self.newlines == 0 self.newlines self newlines 0 b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) b os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) os.read os read self._fd self _fd max(os.fstat(self._fd).st_size, BUFSIZE) max os.fstat(self._fd).st_size os.fstat(self._fd) os.fstat os fstat self._fd self _fd st_size BUFSIZE self.newlines = b.count(b"\n") + (not b) self.newlines self newlines b.count(b"\n") + (not b) b.count(b"\n") b.count b count b"\n" not b b ptr = self.buffer.tell() ptr self.buffer.tell() self.buffer.tell self.buffer self buffer tell self.buffer.seek(0, 2) self.buffer.seek self.buffer self buffer seek 0 2 self.buffer.write(b) self.buffer.write self.buffer self buffer write b self.buffer.seek(ptr) self.buffer.seek self.buffer self buffer seek ptr self.newlines -= 1 self.newlines self newlines 1 return self.buffer.readline() self.buffer.readline() self.buffer.readline self.buffer self buffer readline self self def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
  flush if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
  self.writable self writable os.write(self._fd, self.buffer.getvalue()) os.write os write self._fd self _fd self.buffer.getvalue() self.buffer.getvalue self.buffer self buffer getvalue self.buffer.truncate(0) self.buffer.truncate self.buffer self buffer truncate 0 self.buffer.seek(0) self.buffer.seek self.buffer self buffer seek 0 self self IOBase class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
  IOWrapper def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
  __init__ self.buffer = FastIO(file) self.buffer self buffer FastIO(file) FastIO file self.flush = self.buffer.flush self.flush self flush self.buffer.flush self.buffer self buffer flush self.writable = self.buffer.writable self.writable self writable self.buffer.writable self.buffer self buffer writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.write self write lambda s: self.buffer.write(s.encode("ascii")) self.buffer.write(s.encode("ascii")) self.buffer.write self.buffer self buffer write s.encode("ascii") s.encode s encode "ascii" s self.read = lambda: self.buffer.read().decode("ascii") self.read self read lambda: self.buffer.read().decode("ascii") self.buffer.read().decode("ascii") self.buffer.read().decode self.buffer.read() self.buffer.read self.buffer self buffer read decode "ascii" self.readline = lambda: self.buffer.readline().decode("ascii") self.readline self readline lambda: self.buffer.readline().decode("ascii") self.buffer.readline().decode("ascii") self.buffer.readline().decode self.buffer.readline() self.buffer.readline self.buffer self buffer readline decode "ascii" self self file file IOBase sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) sys.stdin sys stdin IOWrapper(sys.stdin) IOWrapper sys.stdin sys stdin sys.stdout sys stdout IOWrapper(sys.stdout) IOWrapper sys.stdout sys stdout 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" from math import gcd, ceil def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi pre n = len(s) n len(s) len s pi = [0] * n pi [0] * n [0] 0 n for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
     i range(1, n) range 1 n j = pi[j - 1] j pi[j - 1] pi j - 1 j 1 while j and s[i] != s[j]:
            j = pi[j - 1]
         j and s[i] != s[j] j s[i] != s[j] s[i] s i s[j] s j j = pi[j - 1] j pi[j - 1] pi j - 1 j 1 if s[i] == s[j]:
            j += 1
         s[i] == s[j] s[i] s i s[j] s j j += 1 j 1 pi[i] =  j pi[i] pi i j return pi pi s s def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans prod ans = 1 ans 1 for each in a:
        ans = (ans * each)
     each a ans = (ans * each) ans ans * each ans each return ans ans a a def lcm(a, b): return a * b // gcd(a, b) lcm a a b b def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y binary y = bin(x)[2:] y bin(x)[2:] (x) bin x 2: 2 return y if len(y) >= length else '0' * (length - len(y)) + y y if len(y) >= length else '0' * (length - len(y)) + y len(y) >= length len(y) len y length y '0' * (length - len(y)) + y '0' * (length - len(y)) '0' length - len(y) length len(y) len y y x x length=16 length 16 h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m rs = [0] * h rs [0] * h [0] 0 h cs = [0] * w cs [0] * w [0] 0 w se = set() se set() set for i in range(m):
    r, c =  map(int, input().split())
    rs[r - 1] += 1
    cs[c - 1] += 1
    se.add((r - 1) * w + c - 1) i range(m) range m r, c =  map(int, input().split()) r map(int, input().split()) map int input().split() ().split () input split c rs[r - 1] += 1 rs[r - 1] rs r - 1 r 1 1 cs[c - 1] += 1 cs[c - 1] cs c - 1 c 1 1 se.add((r - 1) * w + c - 1) se.add se add (r - 1) * w + c - 1 (r - 1) * w + c (r - 1) * w r - 1 r 1 w c 1 rmax = max(rs) rmax max(rs) max rs cmax = max(cs) cmax max(cs) max cs remax = rs.count(rmax) remax rs.count(rmax) rs.count rs count rmax cemax = cs.count(cmax) cemax cs.count(cmax) cs.count cs count cmax if remax * cemax > m:
    print(rmax + cmax)
    sys.exit(0) remax * cemax > m remax * cemax remax cemax m print(rmax + cmax) print rmax + cmax rmax cmax sys.exit(0) sys.exit sys exit 0 i for i, _ in enumerate(rs) if _ == rmax for i, _ in enumerate(rs) if _ == rmax i _ enumerate(rs) enumerate rs _ == rmax _ rmax if _ == rmax i rmaxs = [i for i, _ in enumerate(rs) if _ == rmax] rmaxs [i for i, _ in enumerate(rs) if _ == rmax] i for i, _ in enumerate(cs) if _ == cmax for i, _ in enumerate(cs) if _ == cmax i _ enumerate(cs) enumerate cs _ == cmax _ cmax if _ == cmax i cmaxs = [i for i, _ in enumerate(cs) if _ == cmax] cmaxs [i for i, _ in enumerate(cs) if _ == cmax] for r in rmaxs:
    for c in cmaxs:
        if r * w + c not in se:
            print(rmax + cmax)
            sys.exit(0) r rmaxs for c in cmaxs:
        if r * w + c not in se:
            print(rmax + cmax)
            sys.exit(0) c cmaxs if r * w + c not in se:
            print(rmax + cmax)
            sys.exit(0) r * w + c not in se r * w + c r * w r w c se print(rmax + cmax) print rmax + cmax rmax cmax sys.exit(0) sys.exit sys exit 0 print(rmax + cmax - 1) print rmax + cmax - 1 rmax + cmax rmax cmax 1 cmaxs = [i for i, _ in enumerate(cs) if _ == cmax] [i for i, _ in enumerate(cs) if _ == cmax] cmaxs cemax = cs.count(cmax) cs.count(cmax) cemax r, c =  map(int, input().split()) map(int, input().split()) r c =  map(int, input().split()) map(int, input().split()) c rmax = max(rs) max(rs) rmax def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y binary class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
  class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
  FastIO def lcm(a, b): return a * b // gcd(a, b) def lcm(a, b): return a * b // gcd(a, b) lcm h, w, m = map(int, input().split()) map(int, input().split()) h input = lambda: sys.stdin.readline().rstrip("\r\n") lambda: sys.stdin.readline().rstrip("\r\n") input m = map(int, input().split()) map(int, input().split()) m remax = rs.count(rmax) rs.count(rmax) remax def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans prod class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
  class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
  IOWrapper w, m = map(int, input().split()) map(int, input().split()) w cmax = max(cs) max(cs) cmax def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi pre rs = [0] * h [0] * h rs BUFSIZE = 8192 8192 BUFSIZE cs = [0] * w [0] * w cs se = set() set() se rmaxs = [i for i, _ in enumerate(rs) if _ == rmax] [i for i, _ in enumerate(rs) if _ == rmax] rmaxs
#-------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# ------------------- fast io --------------------

from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi

def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y


h, w, m = map(int, input().split())
rs = [0] * h
cs = [0] * w

se = set()
for i in range(m):
    r, c =  map(int, input().split())
    rs[r - 1] += 1
    cs[c - 1] += 1
    se.add((r - 1) * w + c - 1)

rmax = max(rs)
cmax = max(cs)

remax = rs.count(rmax)
cemax = cs.count(cmax)
if remax * cemax > m:
    print(rmax + cmax)
    sys.exit(0)

rmaxs = [i for i, _ in enumerate(rs) if _ == rmax]
cmaxs = [i for i, _ in enumerate(cs) if _ == cmax]
for r in rmaxs:
    for c in cmaxs:
        if r * w + c not in se:
            print(rmax + cmax)
            sys.exit(0)

print(rmax + cmax - 1)
