import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

struct P{
  int h, w;
}

void solve(){
  int h = scan!int, w = scan!int, m = scan!int;
  P[] ps;
  foreach(i; 0 .. m) ps ~= P(scan!int - 1, scan!int - 1);
  
  int[] xs = new int[](h);
  foreach(p; ps) xs[p.h] += 1;
  
  int[] ys = new int[](w);
  foreach(p; ps) ys[p.w] += 1;
  
  // Holizontal and vertical can be done separatedly
  
  int[] ansi, ansj;
  int bestx, besty;
  foreach(i; 0 .. h){
    if(xs[i] > bestx) bestx = xs[i], ansi = [];
    if(xs[i] >= bestx) ansi ~= i;
  }
  foreach(j; 0 .. w){
    if(ys[j] > besty) besty = ys[j], ansj = [];
    if(ys[j] >= besty) ansj ~= j;
  }
  
  // If there is no box at some crossing, ans(h) + ans(w) is the answer; else ans(h) + ans(w) - 1
  
  bool[P] pset;
  foreach(p; ps) pset[p] = 1;
  int ansvalue = bestx + besty - 1;
  A: foreach(i; ansi){
    foreach(j; ansj){
      // This loop breaks in at most M times
      if(P(i, j) in pset) continue;
      else{
        ansvalue = bestx + besty;
        break;
      }
    }
  }
  ansvalue.writeln;
  
}
