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

r = Array.new(h+1,0)
r_max = 0
r_max_index = []
c = Array.new(w+1,0)
c_max = 0
c_max_index = []
d = Array.new(h+1) {Array.new(w+1)}
m.times do
    a,b = gets.split.map(&:to_i)

    if r_max < (r[a] += 1)
        r_max = r[a]
        r_max_index = [a]
    elsif r_max == r[a]
        r_max_index << a
    end

    if c_max < (c[b] += 1)
        c_max = c[b]
        c_max_index = [b]
    elsif c_max == c[b]
        c_max_index << b
    end

    d[a][b] = 1
end

r_max_index.each do |a|
    c_max_index.each do |b|
        if !d[a][b]
            p r_max + c_max
            exit
        end
    end
end

p r_max + c_max - 1