H, W, M = gets.chomp.split.map(&:to_i)
pos_h = {}
pos_w = {}
pos = {}
M.times{ |i|
  h, w = gets.chomp.split.map(&:to_i)
  pos_h[h-1] ||= 0
  pos_h[h-1] += 1
  pos_w[w-1] ||= 0
  pos_w[w-1] += 1
  pos[[h-1, w-1]] = true
}

pos_h_max = pos_h.to_a.sort{|a,b| a[1] <=> b[1]}.last
pos_w_max = pos_w.to_a.sort{|a,b| a[1] <=> b[1]}.last

ans = pos_h_max[1] + pos_w_max[1]
if pos[[pos_h_max[0], pos_w_max[0]]]
  ans -= 1
end

puts ans
