h, w, m = gets.chomp.split(" ").map{|i|i.to_i}

boms = Array.new(h) { Array.new(w,0) }
m.times do
	bom_h, bom_w = gets.chomp.split(" ").map{|i|i.to_i-1}
  	boms[bom_h][bom_w] = 1
end

arr = []
h.times do |i|
	w.times do |j|
    
    	w_boms = boms[i].count(1)
      	h_boms = boms.transpose[j].count(1)
      	if boms[i][j] == 1
      		bom_counter = w_boms + h_boms -1
          	arr.push(bom_counter)
        else
          	bom_counter = w_boms + h_boms
          	arr.push(bom_counter)
        end
    end
end

puts arr.max