H,W,M = gets.split.map(&:to_i)
A = readlines.map {|s| s.split.map(&:to_i) }

bh = Array.new(H+1, 0)
bw = Array.new(W+1, 0)

table = A.each_with_object(Hash.new {{}}) {|(y,x),o| (o[y]=o[y])[x] = true }

A.each do |y,x|
  bh[y] += 1
  bw[x] += 1
end

max = 0
ans = 0
bh.each_with_object([]).with_index {|(y,r),i|
  if max < y
    max = y
    r.replace([i])
  elsif max == y
    r << i
  end
}.each do |y|
  bw.each_with_index do |n,x|
    ans = [ans, max + n - (table[y][x] ? 1 : 0)].max
  end
end
puts ans
