H, W, M = gets.chomp.split.map(&:to_i)

bombs = []
hc = {}
wc = {}
M.times do |i|
  h, w = gets.chomp.split.map(&:to_i)
  hc[h] = hc[h].to_i + 1
  wc[w] = wc[w].to_i + 1
  bombs << [h, w]
end

ans = hc.values.max + wc.values.max - 1

hcm = hc.select { |k, v| v == hc.values.max }
wcm = wc.select { |k, v| v == wc.values.max }

catch(:break_loop) do
  hcm.each do |h, _|
    wcm.each do |w, _|
      unless bombs.include?([h, w])
        ans += 1
        throw(:break_loop)
      end
    end
  end
end

print ans