output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      H W M
      h_1 w_1
      \vdots
      h_M w_M
attempt: n, m, k = map(int, input().split())
  c = {}
  e = {}
  for i in range(k):
      a, b = map(int, input().split())
      t = str(a) + "x"
      s = str(b) + "y"
      e[t + s] = 1
      if t in c:
          c[t] += 1
      else:
          c[t] = 1
      if s in c:
          c[s] += 1
      else:
          c[s] = 1
  d = sorted(c.items(), key=lambda x: x[1], reverse=True)
  p, r = d[0]
  w = ""
  p = list(p)
  m = r
  if p[1] == "x":
      for i in range(len(d)):
          u, v = d[i]
          u = list(u)
          if u[1] == "y":
              m += v
              w += "".join(p) + "".join(u)
              break
  else:
      for i in range(len(d)):
          u, v = d[i]
          u = list(u)
          if u[1] == "x":
              m += v
              w += "".join(u) + "".join(p)
              break
  
  if w in e:
      print(m - 1)
  else:
      print(m)
  
problem_description: Statement
  
  We have a two-dimensional grid with H \times W squares. There are M targets to
  destroy in this grid - the position of the i-th target is \left(h_i, w_i
  \right).
  
  Takahashi will choose one square in this grid, place a bomb there, and ignite
  it. The bomb will destroy all targets that are in the row or the column where
  the bomb is placed. It is possible to place the bomb at a square with a
  target.
  
  Takahashi is trying to maximize the number of targets to destroy. Find the
  maximum number of targets that can be destroyed.
samples: [{"input": "2 3 3\n    2 2\n    1 1\n    1 3", "output": "3\n    \n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\n* * *"}, {"input": "3 3 4\n    3 3\n    3 1\n    1 1\n    1 2", "output": "3\n    \n\n* * *"}, {"input": "5 5 10\n    2 5\n    4 3\n    2 3\n    5 5\n    2 2\n    5 4\n    5 3\n    5 1\n    3 5\n    1 4", "output": "6"}]