// solution is at the bottom

import kotlin.math.*

@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar()
        else c
    }
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(true) {
            when(c) {
                '\n', Char.MIN_VALUE -> return@buildString
                else -> {
                    append(c)
                    c = readChar()
                }
            }
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }


fun main() {
    val (n, m, k) = readIntArray(3)
    val colCount = IntArray(m) {0}
    val rowCount = IntArray(n) {0}

    val points = mutableSetOf<Pair<Int, Int>>()
    for (kk in 1..k) {
        var (row, col) = readIntArray(2)
        row--
        col--

        colCount[col]++
        rowCount[row]++

        points.add(Pair(row, col))
    }

//    println(colCount.joinToString(" "))
//    println(rowCount.joinToString(" "))

    val colMax = colCount.max()!!
    val col = colCount.indexOf(colMax)

    var result = 0

    for (row in 0 until n) {
        var ths = colCount[col] + rowCount[row]
        if (Pair(row, col) in points) {
            ths--
        }

        result = max(result, ths)
    }

    val rowMax = rowCount.max()!!
    val row = rowCount.indexOf(rowMax)

    for (col in 0 until m) {
        var ths = colCount[col] + rowCount[row]
        if (Pair(row, col) in points) {
            ths--
        }

        result = max(result, ths)
    }

    println(result)
}
