# reference
# https://atcoder.jp/contests/abc176/submissions/16207205
# https://atcoder.jp/contests/abc176/submissions/16157397
# https://qiita.com/QUANON/items/ca06f3068c87b3a21e18

H, W, M = gets.strip.split.map(&:to_i)

m = []
M.times do
  m.push(gets.strip.split.map { |_| _.to_i - 1 })
end

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
}

hm_count = hh.count(hx)
wm_count = ww.count(wx)

if hm_count * wm_count > m.count{|h,w| hh[h] == hx && ww[w] == wx}
  p hx + wx
else
  p hx + wx - 1
end
