io = DATA.eof? ? STDIN : DATA
h,w,m=io.gets.split.map(&:to_i)
rc=m.times.map{io.gets.split.map(&:to_i)}
r,c=rc.transpose
rtally= r.tally
ctally= c.tally
rmax= rtally.values.max
cmax= ctally.values.max
rct=rtally.count{|r,maxct|maxct==rmax}
cct=ctally.count{|c,maxct|maxct==cmax}
if rct*cct>rc.count{|r,c|rtally[r]==rmax && ctally[c]==cmax}
  puts rmax+cmax
else
  puts rmax+cmax-1
end
