#include <bits/stdc++.h>

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
// #define map unordered_map
// #define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);

  ll H, W, M;
  scanf("%lld %lld %lld", &H, &W, &M);

  vector<ll> list_y;
  vector<ll> list_x;

  map<ll, ll> z;

  for (ll i = 0; i < M; i++) {
    ll y, x;
    scanf("%lld %lld", &y, &x);

    list_y.emplace_back(y);
    list_x.emplace_back(x);

    ll zk = y + x * 100000000LL;
    z[zk] = 1;
  }

  priority_queue<pll, vector<pll>, less<pll>> que_x;  // -> 9,8,7,...
  priority_queue<pll, vector<pll>, less<pll>> que_y;  // -> 9,8,7,...

  sort(list_y.begin(), list_y.end());
  sort(list_x.begin(), list_x.end());

  {
    ll pre_v = list_y[0];
    ll count = 1;
    for (ll i = 1; i < list_y.size(); i++) {
      ll v = list_y[i];
      if (v != pre_v) {
        que_y.push(make_pair(count, pre_v));
        // cout << (count) << " " << (v) << endl;

        count = 1;
      } else {
        count++;
      }
      pre_v = v;
    }
    que_y.push(make_pair(count, pre_v));
    // cout << (count) << " " << (pre_v) << endl;
  }

  {
    ll pre_v = list_x[0];
    ll count = 1;
    for (ll i = 1; i < list_x.size(); i++) {
      ll v = list_x[i];
      if (v != pre_v) {
        que_x.push(make_pair(count, pre_v));
        // cout << (count) << " " << (v) << endl;
        count = 1;
      } else {
        count++;
      }
      pre_v = v;
    }
    que_x.push(make_pair(count, pre_v));
    // cout << (count) << " " << (pre_v) << endl;
  }

  vector<pll> y_max_list;
  vector<pll> x_max_list;

  y_max_list.emplace_back(que_y.top());
  que_y.pop();
  for (;;) {
    if (que_y.empty()) {
      break;
    }
    if (que_y.top().first == y_max_list[0].first) {
      y_max_list.emplace_back(que_y.top());
      que_y.pop();
    } else {
      break;
    }
  }

  x_max_list.emplace_back(que_x.top());
  que_x.pop();
  for (;;) {
    if (que_x.empty()) {
      break;
    }
    if (que_x.top().first == x_max_list[0].first) {
      x_max_list.emplace_back(que_x.top());
      que_x.pop();
    } else {
      break;
    }
  }

  // cout << ("y_max_list") << endl;
  // for (ll i = 0; i < y_max_list.size(); i++) {
  //   auto v = y_max_list[i];
  //   cout << (v.second) << " " << (v.first) << endl;
  // }
  // cout << ("================") << endl;

  // cout << ("x_max_list") << endl;
  // for (ll i = 0; i < x_max_list.size(); i++) {
  //   auto v = x_max_list[i];
  //   cout << (v.second) << " " << (v.first) << endl;
  // }
  // cout << ("================") << endl;

  ll ans = 0;

  for (ll y = 0; y < y_max_list.size(); y++) {
    for (ll x = 0; x < x_max_list.size(); x++) {
      ll sum = 0;
      sum += y_max_list[y].first;
      sum += x_max_list[x].first;

      ll py = y_max_list[y].second;
      ll px = x_max_list[x].second;

      // cout << (py) << "," << (px) << endl;

      ll zk = py + px * 100000000LL;
      if (z[zk]) {
        sum--;
      }

      ans = max(ans, sum);
      if (!z[zk]) {
        break;
      }
    }
  }

  cout << (ans) << endl;
}


Measured memory_bytes: 64024