H,W,M = gets.chomp.split(" ").map(&:to_i)
hash = Hash.new(0)
tate = Array.new(W+1,0)
yoko = Array.new(H+1,0)
h = Array.new(M+1)
w = Array.new(M+1)
M.times do |i|
  h[i],w[i] = gets.chomp.split(" ").map(&:to_i)
  hash[[h[i],w[i]]] = 1
  tate[w[i]] += 1
  yoko[h[i]] += 1
end
max_tate = tate.max
max_yoko = yoko.max
tate_h = Hash.new(0)
yoko_h = Hash.new(0)
W.times do |i|
  if tate[i] == max_tate
    tate_h[i] = max_tate
  end
end
H.times do |i|
  if yoko[i] == max_yoko
    yoko_h[i] = max_yoko
  end
end
tate_h.each_key do |k|
  yoko_h.each_key do |k2|
    if hash[[k2,k]] == 0
      puts max_tate + max_yoko
      exit
    end
  end
end
puts max_tate + max_yoko - 1