H,W,M = gets.split.map(&:to_i)
bombs = Hash.new{false}
r = Array.new(H){0}
c = Array.new(W){0}
M.times{
	h,w = gets.split.map{|i|i.to_i - 1}
	bombs[[h,w]] = true
	r[h] += 1
	c[w] += 1
}
max_rows = []
max_r = 0
H.times{|h|
	if max_r < r[h]
		max_r = r[h]
		max_rows = []
	end
	if max_r == r[h]
		max_rows << h
	end
}
warn max_r
warn max_rows.inspect
max_cols = []
max_c = 0
W.times{|w|
	if max_c < c[w]
		max_c = c[w]
		max_cols = []
	end
	if max_c == c[w]
		max_cols << w
	end
}
warn max_c
warn max_cols.inspect
s = max_r + max_c - 1
f = false
max_rows.each{|h|
	max_cols.each{|w|
		if !bombs[[h,w]]
			warn [h,w].inspect
			s += 1
			f = true
			break
		end
	}
	break if f
}
puts s
