from itertools import product

def zero_origin(s: str) -> int:
  return int(s) - 1

H, W, M = map(int, input().split())
h_obj = [0 for _ in range(H)]
w_obj = [0 for _ in range(W)]
obj = set()
for _ in range(M):
  h, w = map(zero_origin, input().split())
  h_obj[h] += 1
  w_obj[w] += 1
  obj.add((h, w))
max_h = max(h_obj)
max_w = max(w_obj)
h_list = [h for h in range(H) if h_obj[h] == max_h]
w_list = [w for w in range(W) if w_obj[w] == max_w]
for h, w in product(h_list, w_list):
  if (h, w) not in obj:
    print(max_h + max_w)
    break
else:
  print(max_h + max_w - 1) from itertools import product def zero_origin(s: str) -> int:
  return int(s) - 1 zero_origin return int(s) - 1 int(s) - 1 int(s) int s 1 s: str s H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M 0 for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) 0 h_obj = [0 for _ in range(H)] h_obj [0 for _ in range(H)] 0 for _ in range(W) for _ in range(W) _ range(W) range W for _ in range(W) 0 w_obj = [0 for _ in range(W)] w_obj [0 for _ in range(W)] obj = set() obj set() set for _ in range(M):
  h, w = map(zero_origin, input().split())
  h_obj[h] += 1
  w_obj[w] += 1
  obj.add((h, w)) _ range(M) range M h, w = map(zero_origin, input().split()) h map(zero_origin, input().split()) map zero_origin input().split() ().split () input split w h_obj[h] += 1 h_obj[h] h_obj h 1 w_obj[w] += 1 w_obj[w] w_obj w 1 obj.add((h, w)) obj.add obj add (h, w) h w max_h = max(h_obj) max_h max(h_obj) max h_obj max_w = max(w_obj) max_w max(w_obj) max w_obj h for h in range(H) if h_obj[h] == max_h for h in range(H) if h_obj[h] == max_h h range(H) range H h_obj[h] == max_h h_obj[h] h_obj h max_h if h_obj[h] == max_h h h_list = [h for h in range(H) if h_obj[h] == max_h] h_list [h for h in range(H) if h_obj[h] == max_h] w for w in range(W) if w_obj[w] == max_w for w in range(W) if w_obj[w] == max_w w range(W) range W w_obj[w] == max_w w_obj[w] w_obj w max_w if w_obj[w] == max_w w w_list = [w for w in range(W) if w_obj[w] == max_w] w_list [w for w in range(W) if w_obj[w] == max_w] for h, w in product(h_list, w_list):
  if (h, w) not in obj:
    print(max_h + max_w)
    break
else:
  print(max_h + max_w - 1) h w product(h_list, w_list) product h_list w_list if (h, w) not in obj:
    print(max_h + max_w)
    break (h, w) not in obj (h, w) h w obj print(max_h + max_w) print max_h + max_w max_h max_w break print(max_h + max_w - 1) print max_h + max_w - 1 max_h + max_w max_h max_w 1 h_obj = [0 for _ in range(H)] [0 for _ in range(H)] h_obj w_list = [w for w in range(W) if w_obj[w] == max_w] [w for w in range(W) if w_obj[w] == max_w] w_list W, M = map(int, input().split()) map(int, input().split()) W def zero_origin(s: str) -> int:
  return int(s) - 1 def zero_origin(s: str) -> int:
  return int(s) - 1 zero_origin H, W, M = map(int, input().split()) map(int, input().split()) H w_obj = [0 for _ in range(W)] [0 for _ in range(W)] w_obj obj = set() set() obj h_list = [h for h in range(H) if h_obj[h] == max_h] [h for h in range(H) if h_obj[h] == max_h] h_list max_h = max(h_obj) max(h_obj) max_h max_w = max(w_obj) max(w_obj) max_w h, w = map(zero_origin, input().split()) map(zero_origin, input().split()) h M = map(int, input().split()) map(int, input().split()) M w = map(zero_origin, input().split()) map(zero_origin, input().split()) w
from itertools import product

def zero_origin(s: str) -> int:
  return int(s) - 1

H, W, M = map(int, input().split())
h_obj = [0 for _ in range(H)]
w_obj = [0 for _ in range(W)]
obj = set()
for _ in range(M):
  h, w = map(zero_origin, input().split())
  h_obj[h] += 1
  w_obj[w] += 1
  obj.add((h, w))
max_h = max(h_obj)
max_w = max(w_obj)
h_list = [h for h in range(H) if h_obj[h] == max_h]
w_list = [w for w in range(W) if w_obj[w] == max_w]
for h, w in product(h_list, w_list):
  if (h, w) not in obj:
    print(max_h + max_w)
    break
else:
  print(max_h + max_w - 1)