_,_,m = gets.chomp.split(" ").map(&:to_i)

bomb = {}
h_hit = Hash.new{0}
w_hit = Hash.new{0}
h_max = 0
h_max_holder = ""
w_max = 0
w_max_holder = ""

m.times do
  h,w = gets.chomp.split(" ")
  bomb[h+":"+w] = 1
  if h_max == h_hit[h]
    h_max += 1
    h_max_holder = h+" "
  elsif h_max-1 == h_hit[h]
    h_max_holder += h+" "
  end
  h_hit[h] += 1
  if w_max == w_hit[w]
    w_max += 1
    w_max_holder = w+" "
  elsif w_max-1 == w_hit[w]
    w_max_holder += w+" "
  end
  w_hit[w] += 1
end

fin = false

h_max_holder.split(" ").each do |i|
  w_max_holder.split(" ").each do |j|
    if bomb[i+":"+j].nil?
      fin = true
      puts("#{h_max+w_max}")
      break
    end
  end
end

unless fin
  puts("#{h_max+w_max-1}")
end
#p h_hit
#p h_max
#p h_max_holder
#p w_hit
#p w_max
#p w_max_holder