#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1) rt = rt * b % m;
  return rt;
}
pair<int, int> cccnt[300005];
int rrcnt[300005];
int rr[300005], cc[300005];
map<pair<int, int>, int> used;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int r, c, m;
  cin >> r >> c >> m;
  for (int i = 0; i < m; i++) {
    cin >> rr[i] >> cc[i];
    rrcnt[rr[i]]++;
    cccnt[cc[i]].first++;
    cccnt[cc[i]].second = cc[i];
    used[{rr[i], cc[i]}] = 1;
  }
  sort(cccnt, cccnt + 300005, greater<pair<int, int>>());
  int mx = 0;
  for (int i = 1; i <= r; i++) {
    int cur = rrcnt[i];
    for (int j = 0; j <= 20; j++) {
      mx = max(cur + cccnt[j].first - used[{i, cccnt[j].second}], mx);
    }
  }
  cout << mx << endl;
}
