function main(input = "") {
    const lines = input.split("\n");
    const header = lines[0].split(" ").map((v) => (Number(v)));
    const H = header[0], W = header[1], M = header[2];

    let arrH = new Int32Array(H);
    let arrW = new Int32Array(W);
    let grid = new Set();
    for (let i = 0; i < M; i++) {
        let arr = lines[i + 1].split(" ").map((v) => (Number(v)));
        let h = arr[0] - 1, w = arr[1] - 1;
        arrH[h]++;
        arrW[w]++;
        grid.add(h * W + w);
    }

    let maxCnt = -1;
    for (let h = 0; h < H; h++) {
        for (let w = 0; w < W; w++) {
            let id = h * W + w;
            let cnt = arrH[h] + arrW[w] - (grid.has(id) ? 1 : 0);
            if (maxCnt < cnt) {
                maxCnt = cnt;
            }
        }
    }

    return maxCnt;
}

//******************************
exports.main = main;

function Main(input) {
    console.log(main(input.trim()));
}

if (process.argv[2] !== "test") {
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}