# https://atcoder.jp/contests/abc176/submissions/16124424
from collections import Counter
def abc176_e():
  h, w, m = map(int, input().split())
  H = []
  W = []
  for _ in range(m):
    hi, wi = map(int, input().split())
    H.append(hi)
    W.append(wi)
  mosth = Counter(H).most_common()[0]
  mostw = Counter(W).most_common()[0]
  ans1 = mosth[1]
  ans2 = mostw[1]
  wpair = []
  hpair = []
  for i, hi in enumerate(H):
    if hi == mosth[0]: continue
    wpair.append(W[i])
  for i, wi in enumerate(W):
    if wi == mostw[0]: continue
    hpair.append(H[i])
  if wpair:
    ans1 += Counter(wpair).most_common()[0][1]
  if hpair:
    ans2 += Counter(hpair).most_common()[0][1]
  ans = max(ans1, ans2)
  print(ans)

if __name__ == '__main__':
    abc176_e() from collections import Counter def abc176_e():
  h, w, m = map(int, input().split())
  H = []
  W = []
  for _ in range(m):
    hi, wi = map(int, input().split())
    H.append(hi)
    W.append(wi)
  mosth = Counter(H).most_common()[0]
  mostw = Counter(W).most_common()[0]
  ans1 = mosth[1]
  ans2 = mostw[1]
  wpair = []
  hpair = []
  for i, hi in enumerate(H):
    if hi == mosth[0]: continue
    wpair.append(W[i])
  for i, wi in enumerate(W):
    if wi == mostw[0]: continue
    hpair.append(H[i])
  if wpair:
    ans1 += Counter(wpair).most_common()[0][1]
  if hpair:
    ans2 += Counter(hpair).most_common()[0][1]
  ans = max(ans1, ans2)
  print(ans) abc176_e h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m H = [] H [] W = [] W [] for _ in range(m):
    hi, wi = map(int, input().split())
    H.append(hi)
    W.append(wi)
   _ range(m) range m hi, wi = map(int, input().split()) hi map(int, input().split()) map int input().split() ().split () input split wi H.append(hi) H.append H append hi W.append(wi) W.append W append wi mosth = Counter(H).most_common()[0] mosth Counter(H).most_common()[0] (H).most_common() (H).most_common (H) Counter H most_common 0 mostw = Counter(W).most_common()[0] mostw Counter(W).most_common()[0] (W).most_common() (W).most_common (W) Counter W most_common 0 ans1 = mosth[1] ans1 mosth[1] mosth 1 ans2 = mostw[1] ans2 mostw[1] mostw 1 wpair = [] wpair [] hpair = [] hpair [] for i, hi in enumerate(H):
    if hi == mosth[0]: continue
    wpair.append(W[i])
   i hi enumerate(H) enumerate H if hi == mosth[0]: continue
     hi == mosth[0] hi mosth[0] mosth 0 wpair.append(W[i]) wpair.append wpair append W[i] W i for i, wi in enumerate(W):
    if wi == mostw[0]: continue
    hpair.append(H[i])
   i wi enumerate(W) enumerate W if wi == mostw[0]: continue
     wi == mostw[0] wi mostw[0] mostw 0 hpair.append(H[i]) hpair.append hpair append H[i] H i if wpair:
    ans1 += Counter(wpair).most_common()[0][1]
   wpair ans1 += Counter(wpair).most_common()[0][1] ans1 Counter(wpair).most_common()[0][1] [0] (wpair).most_common() (wpair).most_common (wpair) Counter wpair most_common 0 1 if hpair:
    ans2 += Counter(hpair).most_common()[0][1]
   hpair ans2 += Counter(hpair).most_common()[0][1] ans2 Counter(hpair).most_common()[0][1] [0] (hpair).most_common() (hpair).most_common (hpair) Counter hpair most_common 0 1 ans = max(ans1, ans2) ans max(ans1, ans2) max ans1 ans2 print(ans) print ans if __name__ == '__main__':
    abc176_e() __name__ == '__main__' __name__ '__main__' abc176_e() abc176_e def abc176_e():
  h, w, m = map(int, input().split())
  H = []
  W = []
  for _ in range(m):
    hi, wi = map(int, input().split())
    H.append(hi)
    W.append(wi)
  mosth = Counter(H).most_common()[0]
  mostw = Counter(W).most_common()[0]
  ans1 = mosth[1]
  ans2 = mostw[1]
  wpair = []
  hpair = []
  for i, hi in enumerate(H):
    if hi == mosth[0]: continue
    wpair.append(W[i])
  for i, wi in enumerate(W):
    if wi == mostw[0]: continue
    hpair.append(H[i])
  if wpair:
    ans1 += Counter(wpair).most_common()[0][1]
  if hpair:
    ans2 += Counter(hpair).most_common()[0][1]
  ans = max(ans1, ans2)
  print(ans) def abc176_e():
  h, w, m = map(int, input().split())
  H = []
  W = []
  for _ in range(m):
    hi, wi = map(int, input().split())
    H.append(hi)
    W.append(wi)
  mosth = Counter(H).most_common()[0]
  mostw = Counter(W).most_common()[0]
  ans1 = mosth[1]
  ans2 = mostw[1]
  wpair = []
  hpair = []
  for i, hi in enumerate(H):
    if hi == mosth[0]: continue
    wpair.append(W[i])
  for i, wi in enumerate(W):
    if wi == mostw[0]: continue
    hpair.append(H[i])
  if wpair:
    ans1 += Counter(wpair).most_common()[0][1]
  if hpair:
    ans2 += Counter(hpair).most_common()[0][1]
  ans = max(ans1, ans2)
  print(ans) abc176_e
# https://atcoder.jp/contests/abc176/submissions/16124424
from collections import Counter
def abc176_e():
  h, w, m = map(int, input().split())
  H = []
  W = []
  for _ in range(m):
    hi, wi = map(int, input().split())
    H.append(hi)
    W.append(wi)
  mosth = Counter(H).most_common()[0]
  mostw = Counter(W).most_common()[0]
  ans1 = mosth[1]
  ans2 = mostw[1]
  wpair = []
  hpair = []
  for i, hi in enumerate(H):
    if hi == mosth[0]: continue
    wpair.append(W[i])
  for i, wi in enumerate(W):
    if wi == mostw[0]: continue
    hpair.append(H[i])
  if wpair:
    ans1 += Counter(wpair).most_common()[0][1]
  if hpair:
    ans2 += Counter(hpair).most_common()[0][1]
  ans = max(ans1, ans2)
  print(ans)

if __name__ == '__main__':
    abc176_e()