-----Problem Statement-----
You all must have played the game candy crush. So here is a bomb which works much the fruit bomb in candy crush. A designer, Anton, designed a very powerful bomb. The bomb, when placed on a location $(x, y)$ in a $R \times C$ grid, wipes out the row $x$ and column $y$ completely.
You are given a $R\times C$ grid with $N$ targets. You have only one bomb. Your aim is to maximize the damage and hence destroy most number of targets. Given the location of targets on the grid, find out the number of targets that can destroyed.
The grid system uses index starting with $0$.

-----Input-----
- First line contains three space separated integers, $R$, $C$ and $N$. Then, $N$ lines follow.
- Each line contains space separated integers $r$ and $c$ mentioning the location of the target.

-----Output-----
A single integer giving the number of targets that can be destroyed.

-----Constraints-----
- $1 \leq R, C \leq 3 \times 10^5$
- $1 \leq N \leq min(R \times C,  3 \times 10^5)$
- $0 \leq r < R$
- $0 \leq c < C$
- Any input pair $(r, c)$ is not repeated.

-----Subtasks-----
The total marks will be divided into:
- 20% : $R, C \leq 10^3$
- 80% : Original Constraints

-----Sample Input-----
2 3 3
1 1
0 0
0 2

-----Sample Output-----
3

-----EXPLANATION-----
It is possible to destroy all the targets if we place the bomb at $(0, 1)$. Hence, total number of targets destroyed is $3$, which is our answer.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'r,c,n=map(int,input().split())\nar=[]\nfor i in range(n):\n    ar.append(list(map(int,input().split())))\n\nd1={}\n\n\nfor i in ar:\n    try:\n        d1[i[0]]+=1\n    except:\n        d1[i[0]]=1\n\nmaxi=-1\n\nfor i in d1:\n    if d1[i]>maxi:\n        maxi=d1[i]\n        res1=i\n\nd2={}\n\nfor i in ar:\n    if i[0]!=res1:\n        try:\n            d2[i[1]]+=1\n        except:\n            d2[i[1]]=1\n\nmaxi=-1\n\nfor i in d2:\n    if d2[i]>maxi:\n        maxi=d2[i]\n        res2=i\n\nans1=d1[res1]+d2[res2]\n\n\n\n\n\n\n\n\n\nd1={}\n\nfor i in ar:\n    try:\n        d1[i[1]]+=1\n    except:\n        d1[i[1]]=1\n\nmaxi=-1\n\nfor i in d1:\n    if d1[i]>maxi:\n        maxi=d1[i]\n        res1=i\n\nd2={}\n\nfor i in ar:\n    if i[1]!=res1:\n        try:\n            d2[i[0]]+=1\n        except:\n            d2[i[0]]=1\n\nmaxi=-1\n\nfor i in d2:\n    if d2[i]>maxi:\n        maxi=d2[i]\n        res2=i\n\nans2=d1[res1]+d2[res2]\n\nprint(max(ans1,ans2))'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13781