H, W, M = gets.split.map(&:to_i)
map = Array.new(H + 1){ Array.new W + 1 }
hcounts = Array.new H+1, 0
wcounts = Array.new W+1, 0

M.times do
    h, w = gets.split.map(&:to_i)
    map[h][w] = true
    hcounts[h] += 1
    wcounts[w] += 1
end

maxh_list = []
maxh = 1
hcounts.each_with_index do |c, h|
    if c > maxh
        maxh = c
        maxh_list = [h]
    elsif c == maxh
        maxh_list.push(h)
    end
end

maxw_list = []
maxw = 1
wcounts.each_with_index do |c, w|
    if c > maxw
        maxw = c
        maxw_list = [w]
    elsif c == maxw
        maxw_list.push(w)
    end
end

maxh_list.each do |h|
    maxw_list.each do |w|
        unless map[h][w]
            puts maxh + maxw
            exit
        end
    end
end

puts maxh + maxw - 1