// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on
void main()
{
    auto input = stdin.byLine.map!split.joiner;

    long H;
    H = input.front.to!long;
    input.popFront;

    long W;
    W = input.front.to!long;
    input.popFront;

    long M;
    M = input.front.to!long;
    input.popFront;

    long[] h = new long[](cast(size_t)(M));
    long[] w = new long[](cast(size_t)(M));
    foreach (i; 0 .. cast(size_t)(M))
    {
        h[i] = input.front.to!long;
        input.popFront;
        w[i] = input.front.to!long;
        input.popFront;
    }

    solve(H, W, M, h, w);
}

void solve(long H, long W, long M, long[] h, long[] w)
{
    long[long] DH;
    foreach (i; 0 .. M)
    {
        DH[h[i]] = DH.get(h[i], 0) + 1;
    }
    long ansy;
    long cnty;
    foreach (key, value; DH)
    {
        if (cnty < value)
            ansy = key, cnty = value;
    }
    long[long] DW;
    foreach (i; 0 .. M)
    {
        if (h[i] != ansy)
            DW[w[i]] = DW.get(w[i], 0) + 1;
    }
    long ansx;
    long cntx;
    foreach (key, value; DW)
    {
        if (cntx < value)
            ansx = key, cntx = value;
    }
    dprint(ansy, ansx);
    writeln(cnty + cntx);
}
