h,w,m = gets.split.map(&:to_i)
lines = []
line_count = Array.new(w){0}
row_count = Array.new(h){0}
m.times do
  hi,wi = gets.split.map(&:to_i)
  row_count[hi-1] += 1
  line_count[wi-1] += 1
  lines << [hi-1,wi-1]
end

counts = Array.new(h){[0]*w}

max = 0
row_count.each_with_index do |r,i|
  line_count.each_with_index do |l,j|
    counts[i][j] = r + l
    counts[i][j] -= 1 if lines.include?([i,j])
  end
  max = [max,counts[i].max].max
end
puts max