"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var [h,w,m] = nexts(3);
  var y = xArray(0,h), x = xArray(0,w);
  var set = xArray("new Set()",h);
  for(var i = 0; i < m; i++){
    var u = next()-1, v = next()-1;
    set[u].add(v);
    y[u]++, x[v]++;
  }
  var mx = 0, xid = [], yx = 0, yid = [];
  for(var i = 0; i < h; i++){
    if(yx < y[i])yx = y[i], yid = [i];
    else if(yx === y[i])yid.push(i);
  }
  for(var i = 0; i < w; i++){
    if(mx < x[i])mx = x[i], xid = [i];
    else if(mx === x[i])xid.push(i);
  }
  for(var i = 0; i < yid.length; i++)for(var j = 0; j < xid.length; j++){
    var yy = yid[i], xx = xid[j];
    if(!set[yy].has(xx))return mx+yx;
  }
  return mx+yx-1;
}