h,w,m = gets.chomp.split(' ').map(&:to_i)
col_num = []
row_num = []
pairs = []
m.times do
  h,w = gets.chomp.split(' ').map(&:to_i)
  col_num.push(w)
  row_num.push(h)
  pairs.push([w,h])
end
col_most_freq = col_num.max_by {|value| col_num.count(value)}
row_most_freq = row_num.max_by {|value| row_num.count(value)}
if pairs.include? [col_most_freq,row_most_freq]
  puts col_num.count(col_most_freq) + row_num.count(row_most_freq) - 1
else
  puts col_num.count(col_most_freq) + row_num.count(row_most_freq)
end