h,w,m = gets.chomp.split.map(&:to_i)
targets_h = []
targets_w = []
m.times do
  h,w = gets.chomp.split.map(&:to_i)
  targets_h << h
  targets_w << w
end
maxh = targets_h.uniq.max_by{|x| targets_h.count(x)}
ans = 0
maxh_num = []
targets_h.each_with_index do |h,num|
  if h == maxh
    ans +=1
    maxh_num << num
  end
end
targets_w_new = []
targets_w.each_with_index do |w,num|
  next if maxh_num.include?(num)
  targets_w_new << w 
end
maxw = targets_w_new.uniq.max_by{|y| targets_w_new.count(y)}
targets_w_new.each_with_index do |w,num|
  ans +=1 if w == maxw
end
p ans