h, w, m = gets.split(" ").map(&:to_i)

h_map = {}
w_map = {}
grid = []
while line = gets
  line_list = line.chomp.split(" ").map(&:to_i)
  t_h = line_list[0]
  t_w = line_list[1]
  grid << line_list
  if h_map.has_key?(t_h)
    h_map[t_h] += 1
  else
    h_map[t_h] = 1
  end
  if w_map.has_key?(t_w)
    w_map[t_w] += 1
  else
    w_map[t_w] = 1
  end
end
h_max = h_map.max{ |x, y| x[1] <=> y[1] }
w_max = w_map.max{ |x, y| x[1] <=> y[1] }

ans = h_max[1] + w_max[1]

bh = h_max[0]
bw = w_max[0]
grid.each do |line|
  if line[0] == bh && line[1] == bw
    ans -= 1
    break
  end
end
p ans