H,W,M=gets.chomp.split(" ").map(&:to_i)
h_max=0
w_max=0
h_maxs=[]
w_maxs=[]
hs=Array.new(H,0)
ws=Array.new(W,0)
MEMO={}
M.times do
    h,w=gets.chomp.split(" ").map(&:to_i)
    hs[h-1]+=1
    ws[w-1]+=1
    MEMO["#{h-1}_#{w-1}"] = 1
    if hs[h-1] > h_max
        h_max=hs[h-1]
        h_maxs=[h-1]
    elsif hs[h-1] == h_max
        h_maxs.push(h-1)
    end
    if ws[w-1] > w_max
        w_max=ws[w-1]
        w_maxs=[w-1]
    elsif ws[w-1] == w_max
        w_maxs.push(w-1)
    end
end

h_maxs.each do |h|
    w_maxs.each do |w|
        if MEMO["#{h}_#{w}"] == nil
            puts h_max+w_max
            exit
        end
    end
end

puts h_max+w_max-1
