import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal, ROUND_CEILING
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W, M = MAP()

h, w = ZIP(M)
cnt_h = Counter(h)
hm = max(cnt_h.values())
cnt_w = Counter(w)
wm = max(cnt_w.values())
hl = [k for k, v in cnt_h.items() if v == hm]
wl = [k for k, v in cnt_w.items() if v == wm]

s = set()
for h_, w_ in zip(h, w):
    s.add((h_, w_))

ans = hm + wm

for i in hl:
    for j in wl:
        if (i, j) not in s:
            break
    else:
        continue
    break
else:
    ans -= 1
print(ans) import sys, re sys re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from heapq import heappush, heappop from functools import reduce from decimal import Decimal, ROUND_CEILING def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def LIST(): return list(map(int, input().split())) LIST MAP() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) MAP() MAP def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP n n sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = float('inf') INF float('inf') float 'inf' mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 H, W, M = MAP() H MAP() MAP W M h, w = ZIP(M) h ZIP(M) ZIP M w cnt_h = Counter(h) cnt_h Counter(h) Counter h hm = max(cnt_h.values()) hm max(cnt_h.values()) max cnt_h.values() cnt_h.values cnt_h values cnt_w = Counter(w) cnt_w Counter(w) Counter w wm = max(cnt_w.values()) wm max(cnt_w.values()) max cnt_w.values() cnt_w.values cnt_w values k for k, v in cnt_h.items() if v == hm for k, v in cnt_h.items() if v == hm k v cnt_h.items() cnt_h.items cnt_h items v == hm v hm if v == hm k hl = [k for k, v in cnt_h.items() if v == hm] hl [k for k, v in cnt_h.items() if v == hm] k for k, v in cnt_w.items() if v == wm for k, v in cnt_w.items() if v == wm k v cnt_w.items() cnt_w.items cnt_w items v == wm v wm if v == wm k wl = [k for k, v in cnt_w.items() if v == wm] wl [k for k, v in cnt_w.items() if v == wm] s = set() s set() set for h_, w_ in zip(h, w):
    s.add((h_, w_)) h_ w_ zip(h, w) zip h w s.add((h_, w_)) s.add s add (h_, w_) h_ w_ ans = hm + wm ans hm + wm hm wm for i in hl:
    for j in wl:
        if (i, j) not in s:
            break
    else:
        continue
    break
else:
    ans -= 1 i hl for j in wl:
        if (i, j) not in s:
            break
    else:
        continue
     j wl if (i, j) not in s:
            break
     (i, j) not in s (i, j) i j s break continue break ans -= 1 ans 1 print(ans) print ans def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input mod = 10 ** 9 + 7 10 ** 9 + 7 mod M = MAP() MAP() M hl = [k for k, v in cnt_h.items() if v == hm] [k for k, v in cnt_h.items() if v == hm] hl wl = [k for k, v in cnt_w.items() if v == wm] [k for k, v in cnt_w.items() if v == wm] wl cnt_w = Counter(w) Counter(w) cnt_w w = ZIP(M) ZIP(M) w def LIST(): return list(map(int, input().split())) def LIST(): return list(map(int, input().split())) LIST def ZIP(n): return zip(*(MAP() for _ in range(n))) def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP INF = float('inf') float('inf') INF def INT(): return int(input()) def INT(): return int(input()) INT h, w = ZIP(M) ZIP(M) h ans = hm + wm hm + wm ans W, M = MAP() MAP() W ans -= 1 1 ans wm = max(cnt_w.values()) max(cnt_w.values()) wm cnt_h = Counter(h) Counter(h) cnt_h def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP hm = max(cnt_h.values()) max(cnt_h.values()) hm s = set() set() s H, W, M = MAP() MAP() H
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal, ROUND_CEILING
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W, M = MAP()

h, w = ZIP(M)
cnt_h = Counter(h)
hm = max(cnt_h.values())
cnt_w = Counter(w)
wm = max(cnt_w.values())
hl = [k for k, v in cnt_h.items() if v == hm]
wl = [k for k, v in cnt_w.items() if v == wm]

s = set()
for h_, w_ in zip(h, w):
    s.add((h_, w_))

ans = hm + wm

for i in hl:
    for j in wl:
        if (i, j) not in s:
            break
    else:
        continue
    break
else:
    ans -= 1
print(ans)
