function Main(input) {
  	input = input.split("\n")  
  	input = input.map(x => x.split(" "))
  
  	var field = new Array((input[0][0]+1));
	for(let y = 0; y <= input[0][1]; y++) {
 	 field[y] = new Array((input[0][1]+1)).fill(0);
	}
    
    for(let i=1;i<=input[0][2];i++){
    	field[input[i][0]][input[i][1]] = 1
    }
    	
  	let output = 0;
  	let output_temp;
  	for(let x=1;x<=input[0][0];x++){
    	for(let y=1;y<=input[0][1];y++){
          
           output_temp = 0;
          
             for(let i=1;i<=input[0][1];i++){
               
               if(field[i][y]==1){
                  output_temp++
                }
    	
   			  }
             for(let i=1;i<=input[0][2];i++){
               
               if(field[x][i]==1){
                  output_temp++
                }
    	
   			  }
          	if(field[x][y]==1){
            	output_temp--
            }
          
          	if(output_temp>output){
               output = output_temp
             }
  	
         
        }
    }

	console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));