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

ht = Hs.tally
h_max = ht.max_by{_2}.last
hs = ht.select{_2 == h_max}.to_a
wt = Ws.tally
w_max = wt.max_by{_2}.last
ws = wt.select{_2 == w_max}.to_a
puts hs.product(ws).map{|(a, b), (c, d)| b + d - (HWs.any?{_1 == a && _2 == c} ? 1 : 0)}.max