h, w, m = gets.split.map(&:to_i)
c = Array.new(h).map{Array.new(w, 0)}
m.times do
  hm, wm = gets.split.map(&:to_i)
  c[hm-1][wm-1] = 1
end
d = c.transpose
x = []
c.each do |_c|
  x << _c.count(1)
end
y = []
d.each do |_d|
  y << _d.count(1)
end
ans = 0
h.times do |i|
  w.times do |j|
    res = x[i] + y[j] - c[i][j]
    ans = [ans, res].max
    break if ans == m
  end
end
puts ans