
h, w, m = map(int, input().split())

h_b_list = [0 for i in range(h)]
w_b_list = [0 for i in range(w)]

targets = set()
for i in range(m):
  bh, bw = map(int, input().split())
  targets.add((bh, bw))
  h_b_list[bh-1] += 1
  w_b_list[bw-1] += 1
  
h_max = max(h_b_list)
w_max = max(w_b_list)

h_cans = []
w_cans = []
for i in range(h):
  if h_b_list[i] == h_max:
    h_cans.append(i)
    
for i in range(w):
  if w_b_list[i] == w_max:
    w_cans.append(i)

for hi in h_cans:
  for wi in w_cans:
    if (hi+1, wi+1) not in targets:
      print(h_max+w_max)
      exit()
else:
  print(h_max+w_max-1)
 h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m 0 for i in range(h) for i in range(h) i range(h) range h for i in range(h) 0 h_b_list = [0 for i in range(h)] h_b_list [0 for i in range(h)] 0 for i in range(w) for i in range(w) i range(w) range w for i in range(w) 0 w_b_list = [0 for i in range(w)] w_b_list [0 for i in range(w)] targets = set() targets set() set for i in range(m):
  bh, bw = map(int, input().split())
  targets.add((bh, bw))
  h_b_list[bh-1] += 1
  w_b_list[bw-1] += 1
   i range(m) range m bh, bw = map(int, input().split()) bh map(int, input().split()) map int input().split() ().split () input split bw targets.add((bh, bw)) targets.add targets add (bh, bw) bh bw h_b_list[bh-1] += 1 h_b_list[bh-1] h_b_list bh-1 bh 1 1 w_b_list[bw-1] += 1 w_b_list[bw-1] w_b_list bw-1 bw 1 1 h_max = max(h_b_list) h_max max(h_b_list) max h_b_list w_max = max(w_b_list) w_max max(w_b_list) max w_b_list h_cans = [] h_cans [] w_cans = [] w_cans [] for i in range(h):
  if h_b_list[i] == h_max:
    h_cans.append(i)
     i range(h) range h if h_b_list[i] == h_max:
    h_cans.append(i)
     h_b_list[i] == h_max h_b_list[i] h_b_list i h_max h_cans.append(i) h_cans.append h_cans append i for i in range(w):
  if w_b_list[i] == w_max:
    w_cans.append(i) i range(w) range w if w_b_list[i] == w_max:
    w_cans.append(i) w_b_list[i] == w_max w_b_list[i] w_b_list i w_max w_cans.append(i) w_cans.append w_cans append i for hi in h_cans:
  for wi in w_cans:
    if (hi+1, wi+1) not in targets:
      print(h_max+w_max)
      exit()
else:
  print(h_max+w_max-1) hi h_cans for wi in w_cans:
    if (hi+1, wi+1) not in targets:
      print(h_max+w_max)
      exit() wi w_cans if (hi+1, wi+1) not in targets:
      print(h_max+w_max)
      exit() (hi+1, wi+1) not in targets (hi+1, wi+1) hi+1 hi 1 wi+1 wi 1 targets print(h_max+w_max) print h_max+w_max h_max w_max exit() exit print(h_max+w_max-1) print h_max+w_max-1 h_max+w_max h_max w_max 1 bh, bw = map(int, input().split()) map(int, input().split()) bh w, m = map(int, input().split()) map(int, input().split()) w targets = set() set() targets h_cans = [] [] h_cans h, w, m = map(int, input().split()) map(int, input().split()) h w_cans = [] [] w_cans w_max = max(w_b_list) max(w_b_list) w_max m = map(int, input().split()) map(int, input().split()) m w_b_list = [0 for i in range(w)] [0 for i in range(w)] w_b_list h_max = max(h_b_list) max(h_b_list) h_max bw = map(int, input().split()) map(int, input().split()) bw h_b_list = [0 for i in range(h)] [0 for i in range(h)] h_b_list

h, w, m = map(int, input().split())

h_b_list = [0 for i in range(h)]
w_b_list = [0 for i in range(w)]

targets = set()
for i in range(m):
  bh, bw = map(int, input().split())
  targets.add((bh, bw))
  h_b_list[bh-1] += 1
  w_b_list[bw-1] += 1
  
h_max = max(h_b_list)
w_max = max(w_b_list)

h_cans = []
w_cans = []
for i in range(h):
  if h_b_list[i] == h_max:
    h_cans.append(i)
    
for i in range(w):
  if w_b_list[i] == w_max:
    w_cans.append(i)

for hi in h_cans:
  for wi in w_cans:
    if (hi+1, wi+1) not in targets:
      print(h_max+w_max)
      exit()
else:
  print(h_max+w_max-1)

