func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let arr1 = readInts()
    let H = arr1[0]
    let W = arr1[1]
    let M = arr1[2]
    var bombs = [(Int, Int)]()
    for _ in 1...M {
        let bomb = readInts()
        bombs.append((bomb[0], bomb[1]))
    }
    var max = 0
    for h in 1...H {
        for w in 1...W {
            var count = 0
            for bomb in bombs {
                if bomb.0 == h || bomb.1 == w {
                    count += 1
                }
            }
            if max < count {
                max = count
            }
        }
    }
    print("\(max)")
}

main()
