func readThreeInts(separator: String.Element = " ") -> (a: Int, b: Int, c: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1], c: ints[2])
}

func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func mainE() {
    let (H, W, M) = readThreeInts()

    let points: [(y: Int, x: Int)] = (0..<M).map { _ in readTwoInts() }

    var yCount: [Int] = .init(repeating: 0, count: H)
    var xCount: [Int] = .init(repeating: 0, count: W)

    // 集計
    for point in points {
        xCount[point.x - 1] += 1
        yCount[point.y - 1] += 1
    }

    let answerX = xCount.max()!
    let answerY = yCount.max()!
    let answerXIndex = xCount.firstIndex(of: answerX)! + 1
    let answerYIndex = yCount.firstIndex(of: answerY)! + 1

    var answer = answerX + answerY

    if points.contains(where: { (y, x) in
        return (x == answerXIndex) && (y == answerYIndex)
    }) {
        answer -= 1
    }

    print(answer)
}
mainE()