#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  vector<int> H(A), W(B);
  int mh = 0, mw = 0;
  set<pair<int, int>> S;
  for (int h, w; cin >> h >> w;) {
    mh = max(mh, ++H.at(--h));
    mw = max(mw, ++W.at(--w));
    S.insert({h, w});
  }
  set<int> X, Y;
  for (int i = 0; i < A; i++) if (H.at(i) == mh) X.insert(i);
  for (int i = 0; i < B; i++) if (W.at(i) == mw) Y.insert(i);
  int cnt = 0;
  for (auto [x, y] : S) if (X.count(x) && Y.count(y)) cnt++;
  int siz = X.size() * Y.size();
  cout << mh + mw - (cnt == siz) << "\n";
}