import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
@njit((i8[:],i8[:],i8[:],i8[:]), cache=True)
def main(lis_h,lis_w,bomb_h,bomb_w):
  bomb = {}
  for h,w in zip(bomb_h,bomb_w):
    bomb[(h,w)] = 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i,l in enumerate(lis_h):
    if l==m_h:
      m_h_lis.append(i)
  for i,l in enumerate(lis_w):
    if l==m_w:
      m_w_lis.append(i)
  ans = m_h+m_w
  for h in m_h_lis:
    for w in m_w_lis:
      if (h,w) not in bomb:
        return ans
  return ans-1

H, W, M = map(int, input().split())
bombh = np.zeros(M, np.int64)
bombw = np.zeros(M, np.int64)
lis_h = np.zeros(H, np.int64)
lis_w = np.zeros(W, np.int64)
for i in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bombh[i], bombw[i] = h,w
    lis_h[h] += 1
    lis_w[w] += 1
print(main(lis_h,lis_w,bombh,bombw)) import numpy as np numpy import numba numba from numba import njit, b1, i4, i8, f8 def main(lis_h,lis_w,bomb_h,bomb_w):
  bomb = {}
  for h,w in zip(bomb_h,bomb_w):
    bomb[(h,w)] = 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i,l in enumerate(lis_h):
    if l==m_h:
      m_h_lis.append(i)
  for i,l in enumerate(lis_w):
    if l==m_w:
      m_w_lis.append(i)
  ans = m_h+m_w
  for h in m_h_lis:
    for w in m_w_lis:
      if (h,w) not in bomb:
        return ans
  return ans-1 main bomb = {} bomb {} for h,w in zip(bomb_h,bomb_w):
    bomb[(h,w)] = 1
   h w zip(bomb_h,bomb_w) zip bomb_h bomb_w bomb[(h,w)] = 1 bomb[(h,w)] bomb (h,w) h w 1 m_h = max(lis_h) m_h max(lis_h) max lis_h m_w = max(lis_w) m_w max(lis_w) max lis_w m_h_lis = [] m_h_lis [] m_w_lis = [] m_w_lis [] for i,l in enumerate(lis_h):
    if l==m_h:
      m_h_lis.append(i)
   i l enumerate(lis_h) enumerate lis_h if l==m_h:
      m_h_lis.append(i)
   l==m_h l m_h m_h_lis.append(i) m_h_lis.append m_h_lis append i for i,l in enumerate(lis_w):
    if l==m_w:
      m_w_lis.append(i)
   i l enumerate(lis_w) enumerate lis_w if l==m_w:
      m_w_lis.append(i)
   l==m_w l m_w m_w_lis.append(i) m_w_lis.append m_w_lis append i ans = m_h+m_w ans m_h+m_w m_h m_w for h in m_h_lis:
    for w in m_w_lis:
      if (h,w) not in bomb:
        return ans
   h m_h_lis for w in m_w_lis:
      if (h,w) not in bomb:
        return ans
   w m_w_lis if (h,w) not in bomb:
        return ans
   (h,w) not in bomb (h,w) h w bomb return ans ans return ans-1 ans-1 ans 1 lis_h lis_h lis_w lis_w bomb_h bomb_h bomb_w bomb_w @njit((i8[:],i8[:],i8[:],i8[:]), cache=True) main (i8[:],i8[:],i8[:],i8[:]), cache=True @njit((i8[:],i8[:],i8[:],i8[:]), cache=True) njit (i8[:],i8[:],i8[:],i8[:]) i8[:] i8 : i8[:] i8 : i8[:] i8 : i8[:] i8 : cache=True cache True main H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M bombh = np.zeros(M, np.int64) bombh np.zeros(M, np.int64) np.zeros np zeros M np.int64 np int64 bombw = np.zeros(M, np.int64) bombw np.zeros(M, np.int64) np.zeros np zeros M np.int64 np int64 lis_h = np.zeros(H, np.int64) lis_h np.zeros(H, np.int64) np.zeros np zeros H np.int64 np int64 lis_w = np.zeros(W, np.int64) lis_w np.zeros(W, np.int64) np.zeros np zeros W np.int64 np int64 for i in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bombh[i], bombw[i] = h,w
    lis_h[h] += 1
    lis_w[w] += 1 i range(M) range M h,w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h -= 1 h 1 w -= 1 w 1 bombh[i], bombw[i] = h,w bombh[i] bombh i h bombw[i] bombw i w lis_h[h] += 1 lis_h[h] lis_h h 1 lis_w[w] += 1 lis_w[w] lis_w w 1 print(main(lis_h,lis_w,bombh,bombw)) print main(lis_h,lis_w,bombh,bombw) main lis_h lis_w bombh bombw w -= 1 1 w lis_w = np.zeros(W, np.int64) np.zeros(W, np.int64) lis_w lis_h = np.zeros(H, np.int64) np.zeros(H, np.int64) lis_h W, M = map(int, input().split()) map(int, input().split()) W M = map(int, input().split()) map(int, input().split()) M bombw = np.zeros(M, np.int64) np.zeros(M, np.int64) bombw w = map(int, input().split()) map(int, input().split()) w H, W, M = map(int, input().split()) map(int, input().split()) H bombh = np.zeros(M, np.int64) np.zeros(M, np.int64) bombh h -= 1 1 h def main(lis_h,lis_w,bomb_h,bomb_w):
  bomb = {}
  for h,w in zip(bomb_h,bomb_w):
    bomb[(h,w)] = 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i,l in enumerate(lis_h):
    if l==m_h:
      m_h_lis.append(i)
  for i,l in enumerate(lis_w):
    if l==m_w:
      m_w_lis.append(i)
  ans = m_h+m_w
  for h in m_h_lis:
    for w in m_w_lis:
      if (h,w) not in bomb:
        return ans
  return ans-1 def main(lis_h,lis_w,bomb_h,bomb_w):
  bomb = {}
  for h,w in zip(bomb_h,bomb_w):
    bomb[(h,w)] = 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i,l in enumerate(lis_h):
    if l==m_h:
      m_h_lis.append(i)
  for i,l in enumerate(lis_w):
    if l==m_w:
      m_w_lis.append(i)
  ans = m_h+m_w
  for h in m_h_lis:
    for w in m_w_lis:
      if (h,w) not in bomb:
        return ans
  return ans-1 main h,w = map(int, input().split()) map(int, input().split()) h
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
@njit((i8[:],i8[:],i8[:],i8[:]), cache=True)
def main(lis_h,lis_w,bomb_h,bomb_w):
  bomb = {}
  for h,w in zip(bomb_h,bomb_w):
    bomb[(h,w)] = 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i,l in enumerate(lis_h):
    if l==m_h:
      m_h_lis.append(i)
  for i,l in enumerate(lis_w):
    if l==m_w:
      m_w_lis.append(i)
  ans = m_h+m_w
  for h in m_h_lis:
    for w in m_w_lis:
      if (h,w) not in bomb:
        return ans
  return ans-1

H, W, M = map(int, input().split())
bombh = np.zeros(M, np.int64)
bombw = np.zeros(M, np.int64)
lis_h = np.zeros(H, np.int64)
lis_w = np.zeros(W, np.int64)
for i in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bombh[i], bombw[i] = h,w
    lis_h[h] += 1
    lis_w[w] += 1
print(main(lis_h,lis_w,bombh,bombw))
