h,w,m = gets.split.map(&:to_i)
tate = Array.new(h,0)
yoko = Array.new(w,0)
z = Array.new(0)

for i in 0...m
  temp = gets.split.map(&:to_i)
  temp[0]-=1
  temp[1]-=1
  tate[temp[0]] += 1
  yoko[temp[1]] += 1
  z.push temp
end

tate1 = Array.new(0)
yoko1 = Array.new(0)

max_t = 0
max_y = 0

for i in 0...h
  if max_t<tate[i]
    max_t = tate[i]
    tate1 = Array.new(1,i)
  elsif max_t==tate[i]
    tate1.push i
  end
end
for i in 0...w
  if max_y<yoko[i]
    max_y = yoko[i]
    yoko1 = Array.new(1,i)
  elsif max_y==yoko[i]
    yoko1.push i
  end
end

for i in tate1
  for j in yoko1
    if !z.include?([i,j])
      puts max_t+max_y
      return
    end
  end
end
puts max_t+max_y-1