import sys
input = sys.stdin.readline
H, W, M = map(int, input().split())
s = set()
ys = [0] * (H + 1)
xs = [0] * (W + 1)
for _ in range(M):
  y, x = map(int, input().split())
  s.add((y, x))
  ys[y] += 1
  xs[x] += 1

res = 0
mxy = []
mx = max(ys)
for i in range(H + 1):
  if ys[i] == mx: mxy.append(i)
res += mx

mxx = []
mx = max(xs)
for i in range(W + 1):
  if xs[i] == mx: mxx.append(i)
res += mx - 1

for x in mxx:
  for y in mxy:
    if (y, x) in s: continue
    res += 1
    break
  else: continue
  break
print(res) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M s = set() s set() set ys = [0] * (H + 1) ys [0] * (H + 1) [0] 0 H + 1 H 1 xs = [0] * (W + 1) xs [0] * (W + 1) [0] 0 W + 1 W 1 for _ in range(M):
  y, x = map(int, input().split())
  s.add((y, x))
  ys[y] += 1
  xs[x] += 1 _ range(M) range M y, x = map(int, input().split()) y map(int, input().split()) map int input().split() ().split () input split x s.add((y, x)) s.add s add (y, x) y x ys[y] += 1 ys[y] ys y 1 xs[x] += 1 xs[x] xs x 1 res = 0 res 0 mxy = [] mxy [] mx = max(ys) mx max(ys) max ys for i in range(H + 1):
  if ys[i] == mx: mxy.append(i) i range(H + 1) range H + 1 H 1 if ys[i] == mx: mxy.append( ys[i] == mx ys[i] ys i mx res += mx res mx mxx = [] mxx [] mx = max(xs) mx max(xs) max xs for i in range(W + 1):
  if xs[i] == mx: mxx.append(i) i range(W + 1) range W + 1 W 1 if xs[i] == mx: mxx.append( xs[i] == mx xs[i] xs i mx res += mx - 1 res mx - 1 mx 1 for x in mxx:
  for y in mxy:
    if (y, x) in s: continue
    res += 1
    break
  else: continue
  break x mxx for y in mxy:
    if (y, x) in s: continue
    res += 1
    break
  else: continue
   y mxy if (y, x) in s: continue
     (y, x) in s (y, x) y x s res += 1 res 1 break break print(res) print res xs = [0] * (W + 1) [0] * (W + 1) xs mxy = [] [] mxy mxx = [] [] mxx res += 1 1 res mx = max(ys) max(ys) mx mx = max(xs) max(xs) mx y, x = map(int, input().split()) map(int, input().split()) y W, M = map(int, input().split()) map(int, input().split()) W M = map(int, input().split()) map(int, input().split()) M res = 0 0 res res += mx mx res input = sys.stdin.readline sys.stdin.readline input res += mx - 1 mx - 1 res x = map(int, input().split()) map(int, input().split()) x H, W, M = map(int, input().split()) map(int, input().split()) H ys = [0] * (H + 1) [0] * (H + 1) ys s = set() set() s
import sys
input = sys.stdin.readline
H, W, M = map(int, input().split())
s = set()
ys = [0] * (H + 1)
xs = [0] * (W + 1)
for _ in range(M):
  y, x = map(int, input().split())
  s.add((y, x))
  ys[y] += 1
  xs[x] += 1

res = 0
mxy = []
mx = max(ys)
for i in range(H + 1):
  if ys[i] == mx: mxy.append(i)
res += mx

mxx = []
mx = max(xs)
for i in range(W + 1):
  if xs[i] == mx: mxx.append(i)
res += mx - 1

for x in mxx:
  for y in mxy:
    if (y, x) in s: continue
    res += 1
    break
  else: continue
  break
print(res)