h, w, m = gets.split.map(&:to_i)

r = Array.new(h+1,0)
c = Array.new(w+1,0)
d = Hash.new {|hash,key| hash[key] = {}}
m.times do
    a,b = gets.split.map(&:to_i)
    r[a] += 1
    c[b] += 1
    d[a][b] = 1
end

r_max = r.max
r = (1..h).filter{|a| r[a] == r_max}

c_max = c.max
c = (1..w).filter{|b| c[b] == c_max}

if r.size * c.size > m
    p r_max + c_max
else
    p r_max + c_max - (r.product(c).all?{|a,b| d[a][b]} ? 1 : 0)
end