local H,W,M=io.read("n","n","n")
local bombx={}
local bomby={}
local map={}
for i=1,math.max(H,M) do
    bombx[i]={}
    bomby[i]={}
    map[i]={}
end
local t={}
for i=1,M do
    local h,w=io.read("n","n")
    table.insert(bombx[w],h)
    table.insert(bomby[h],w)
    map[h][w]=true
    t[i]={h,w}
end

local max=0
local hmax=0
local wmax=0
local maxx={}
local maxy={}
for i=1,M do
    local w=t[i][2]
    local h=t[i][1]
    if hmax<#bomby[h] then
        hmax=#bomby[h]
        table.insert(maxy,h)
    end
    if wmax<#bombx[w] then
        wmax=#bombx[w]
        table.insert(maxx,w)
    end
    max=math.max(max,#bombx[w]+#bomby[h]-1)
end

for i=1,#maxy do
    for j=1,#maxx do
        if (not map[i]) or (map[i] and (not map[i][j])) then
            max=max+1
            break
        end
    end
end
print(max)