H, W, M = gets.split.map(&:to_i)
HWs = readlines.map{_1.split.map(&:to_i)}
Hs, Ws = HWs.transpose

ht, wt = Hs.tally, Ws.tally
hm, wm = ht.max_by{_2}.last, wt.max_by{_2}.last
hn, wn = ht.count{_2 == hm}, wt.count{_2 == wm}
puts hm + wm - (hn*wn > HWs.count{ht[_1] == hm && wt[_2] == wm} ? 0 : 1)