#!/usr/bin/env ruby

H, W, M = gets.chomp.split.map(&:to_i)

x = Hash.new(0)
y = Hash.new(0)

maxi = -1
maxj = -1
bomb = {}

M.times do
  i, j = gets.chomp.split.map(&:to_i)

  i -= 1
  j -= 1

  x[i] += 1
  y[j] += 1

  maxi = i if x[maxi] < x[i]
  maxj = j if y[maxj] < y[j]

  bomb[i] ||= {}
  bomb[i][j] = true
end

ans = x[maxi] + y[maxj]
ans -= 1 if bomb[maxi] && bomb[maxi][maxj]

puts ans
