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

h = {}
w = {}
xy = []
M.times do
  ht, wt = gets.strip.split.map(&:to_i)
  xy.push [ht, wt]
  h["#{ht}"] = h["#{ht}"].to_i + 1
  w["#{wt}"] = w["#{wt}"].to_i + 1
end

x = h.max_by { |(_key, value)| value }
y = w.max_by { |_key, value| value }

if xy.include?([x[0].to_i, y[0].to_i])
  puts x[1] + y[1] - 1
else
  puts x[1] + y[1]
end
