H,W,M = gets.split.map(&:to_i)
m = $<.map{|ln| ln.split.map{|_|_.to_i-1} }

hx,hh = 0,[0]*H
wx,ww = 0,[0]*W
m.each{|h,w|
	hx = hh[h] if hx < hh[h]+=1
	wx = ww[w] if wx < ww[w]+=1
}

hxn = hh.count(hx)
wxn = ww.count(wx)
mxn = m.count{|h,w| hh[h]==hx && ww[w]==wx }

p hx+wx-(mxn==hxn*wxn ? 1 : 0)
