h, w, m = gets.chomp.split.map(&:to_i)
xys = Hash.new(0)
rows = Hash.new(0)
cols = Hash.new(0)

m.times do |i|
  hi, wi = gets.chomp.split.map(&:to_i)
  rows[hi] += 1
  cols[wi] += 1
  xys[[hi, wi]] += 1
end

rx = rows.to_a.sort_by! {|_, v| v }
ry = cols.to_a.sort_by! {|_, v| v }

mx = rx[-1][1]
my = ry[-1][1]

rx = rx.filter {|_, v| v == mx }
ry = ry.filter {|_, v| v == my }

res = mx + my - 1
rx.each do |x, _|
  ry.each do |y, _|
    if xys[[x, y]] == 0
      res += 1
      break
    end
  end
end
puts res