#include <bits/stdc++.h>
using namespace std;
int main() {
  long long h, w, m;
  long long hi, wi;
  long long maxh = -1;
  long long maxw = -1;
  long long ans;
  long long buf1, buf2;
  cin >> h >> w >> m;
  vector<int> vh(h);
  vector<int> vw(w);
  vector<pair<int, int>> a;
  for (int i = 0; i < (m); i++) {
    cin >> hi >> wi;
    hi--;
    wi--;
    vh[hi]++;
    vw[wi]++;
    a.push_back({hi, wi});
  }
  for (int i = 0; i < (h); i++) {
    if (maxh < vh[i]) {
      maxh = vh[i];
      buf1 = i;
    }
  }
  for (int i = 0; i < (w); i++) {
    if (maxw < vw[i]) {
      maxw = vw[i];
      buf2 = i;
    }
  }
  ans = maxh + maxw;
  pair<int, int> s(buf1, buf2);
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == s) ans--;
  }
  cout << ans << endl;
  return 0;
}
