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

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[temp[0]][temp[1]] = false
end

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

max_t = tate.max
max_y = yoko.max

for i in 0...h
  if max_t==tate[i]
    tate1.push i
  end
end
for i in 0...w
  if max_y==yoko[i]
    yoko1.push i
  end
end

for i in tate1
  for j in yoko1
    if z[i][j]
      puts max_t+max_y
      return
    end
  end
end
puts max_t+max_y-1