#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

def main():
    H, W, M = LI()
    hw = LIR(M)

    s = set(h + w * (10 ** 6) for h, w in hw)

    ch = Counter(i for i, _ in hw)
    cw = Counter(j for _, j in hw)
    _, maxcy = ch.most_common(1)[0]
    _, maxcx = cw.most_common(1)[0]

    ans = maxcy + maxcx - 1

    lh = [k for k, v in ch.items() if v == maxcy]
    lw = [k for k, v in cw.items() if v == maxcx]

    for h in lh:
        for w in lw:
            if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
    print(ans)




if __name__ == '__main__':
    main() from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools itertools import math, fractions math fractions import sys, copy sys copy def L(): return sys.stdin.readline().split() L def I(): return int(sys.stdin.readline().rstrip()) I def SL(): return list(sys.stdin.readline().rstrip()) SL int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI int(x) - 1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) - 1 int(x) int x 1 def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()] LI1 list(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() list(x) list x def LS(): return [list(x) for x in sys.stdin.readline().split()] LS sys.stdin.readline().strip() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip def R(n): return [sys.stdin.readline().strip() for _ in range(n)] R n n L() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) L() L def LR(n): return [L() for _ in range(n)] LR n n I() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) I() I def IR(n): return [I() for _ in range(n)] IR n n LI() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) LI() LI def LIR(n): return [LI() for _ in range(n)] LIR n n LI1() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) LI1() LI1 def LIR1(n): return [LI1() for _ in range(n)] LIR1 n n SL() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) SL() SL def SR(n): return [SL() for _ in range(n)] SR n n LS() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) LS() LS def LSR(n): return [LS() for _ in range(n)] LSR n n def perm(n, r): return math.factorial(n) // math.factorial(r) perm n n r r def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r)) comb n n r r make_list(*args, default=default) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) make_list(*args, default=default) make_list *args args default=default default default def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)] make_list n n default=0 default 0 *args dire = [[1, 0], [0, 1], [-1, 0], [0, -1]] dire [[1, 0], [0, 1], [-1, 0], [0, -1]] [1, 0] 1 0 [0, 1] 0 1 [-1, 0] -1 0 [0, -1] 0 -1 dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] dire8 [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] [1, 0] 1 0 [1, 1] 1 1 [0, 1] 0 1 [-1, 1] -1 1 [-1, 0] -1 0 [-1, -1] -1 -1 [0, -1] 0 -1 [1, -1] 1 -1 alphabets = "abcdefghijklmnopqrstuvwxyz" alphabets "abcdefghijklmnopqrstuvwxyz" ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ALPHABETS "ABCDEFGHIJKLMNOPQRSTUVWXYZ" MOD = 1000000007 MOD 1000000007 INF = float("inf") INF float("inf") float "inf" sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 def main():
    H, W, M = LI()
    hw = LIR(M)

    s = set(h + w * (10 ** 6) for h, w in hw)

    ch = Counter(i for i, _ in hw)
    cw = Counter(j for _, j in hw)
    _, maxcy = ch.most_common(1)[0]
    _, maxcx = cw.most_common(1)[0]

    ans = maxcy + maxcx - 1

    lh = [k for k, v in ch.items() if v == maxcy]
    lw = [k for k, v in cw.items() if v == maxcx]

    for h in lh:
        for w in lw:
            if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
    print(ans) main H, W, M = LI() H LI() LI W M hw = LIR(M) hw LIR(M) LIR M s = set(h + w * (10 ** 6) for h, w in hw) s set(h + w * (10 ** 6) for h, w in hw) set h + w * (10 ** 6) h w * (10 ** 6) w 10 ** 6 10 6 ch = Counter(i for i, _ in hw) ch Counter(i for i, _ in hw) Counter i cw = Counter(j for _, j in hw) cw Counter(j for _, j in hw) Counter j _, maxcy = ch.most_common(1)[0] _ ch.most_common(1)[0] ch.most_common(1) ch.most_common ch most_common 1 0 maxcy _, maxcx = cw.most_common(1)[0] _ cw.most_common(1)[0] cw.most_common(1) cw.most_common cw most_common 1 0 maxcx ans = maxcy + maxcx - 1 ans maxcy + maxcx - 1 maxcy + maxcx maxcy maxcx 1 k for k, v in ch.items() if v == maxcy for k, v in ch.items() if v == maxcy k v ch.items() ch.items ch items v == maxcy v maxcy if v == maxcy k lh = [k for k, v in ch.items() if v == maxcy] lh [k for k, v in ch.items() if v == maxcy] k for k, v in cw.items() if v == maxcx for k, v in cw.items() if v == maxcx k v cw.items() cw.items cw items v == maxcx v maxcx if v == maxcx k lw = [k for k, v in cw.items() if v == maxcx] lw [k for k, v in cw.items() if v == maxcx] for h in lh:
        for w in lw:
            if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
     h lh for w in lw:
            if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
     w lw if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
     not h + w * (10 ** 6) in s h + w * (10 ** 6) in s h + w * (10 ** 6) h w * (10 ** 6) w 10 ** 6 10 6 s print(ans + 1) print ans + 1 ans 1 return print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def LIR(n): return [LI() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] LIR def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)] def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)] make_list INF = float("inf") float("inf") INF dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] dire8 def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ALPHABETS def main():
    H, W, M = LI()
    hw = LIR(M)

    s = set(h + w * (10 ** 6) for h, w in hw)

    ch = Counter(i for i, _ in hw)
    cw = Counter(j for _, j in hw)
    _, maxcy = ch.most_common(1)[0]
    _, maxcx = cw.most_common(1)[0]

    ans = maxcy + maxcx - 1

    lh = [k for k, v in ch.items() if v == maxcy]
    lw = [k for k, v in cw.items() if v == maxcx]

    for h in lh:
        for w in lw:
            if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
    print(ans) def main():
    H, W, M = LI()
    hw = LIR(M)

    s = set(h + w * (10 ** 6) for h, w in hw)

    ch = Counter(i for i, _ in hw)
    cw = Counter(j for _, j in hw)
    _, maxcy = ch.most_common(1)[0]
    _, maxcx = cw.most_common(1)[0]

    ans = maxcy + maxcx - 1

    lh = [k for k, v in ch.items() if v == maxcy]
    lw = [k for k, v in cw.items() if v == maxcx]

    for h in lh:
        for w in lw:
            if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
    print(ans) main def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()] LI1 def SL(): return list(sys.stdin.readline().rstrip()) def SL(): return list(sys.stdin.readline().rstrip()) SL def R(n): return [sys.stdin.readline().strip() for _ in range(n)] def R(n): return [sys.stdin.readline().strip() for _ in range(n)] R def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def perm(n, r): return math.factorial(n) // math.factorial(r) def perm(n, r): return math.factorial(n) // math.factorial(r) perm dire = [[1, 0], [0, 1], [-1, 0], [0, -1]] [[1, 0], [0, 1], [-1, 0], [0, -1]] dire def SR(n): return [SL() for _ in range(n)] def SR(n): return [SL() for _ in range(n)] SR def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r)) def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r)) comb def L(): return sys.stdin.readline().split() def L(): return sys.stdin.readline().split() L def IR(n): return [I() for _ in range(n)] def IR(n): return [I() for _ in range(n)] IR def LR(n): return [L() for _ in range(n)] def LR(n): return [L() for _ in range(n)] LR def LIR1(n): return [LI1() for _ in range(n)] def LIR1(n): return [LI1() for _ in range(n)] LIR1 def LSR(n): return [LS() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] LSR MOD = 1000000007 1000000007 MOD alphabets = "abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz" alphabets def LS(): return [list(x) for x in sys.stdin.readline().split()] def LS(): return [list(x) for x in sys.stdin.readline().split()] LS
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

def main():
    H, W, M = LI()
    hw = LIR(M)

    s = set(h + w * (10 ** 6) for h, w in hw)

    ch = Counter(i for i, _ in hw)
    cw = Counter(j for _, j in hw)
    _, maxcy = ch.most_common(1)[0]
    _, maxcx = cw.most_common(1)[0]

    ans = maxcy + maxcx - 1

    lh = [k for k, v in ch.items() if v == maxcy]
    lw = [k for k, v in cw.items() if v == maxcx]

    for h in lh:
        for w in lw:
            if not h + w * (10 ** 6) in s:
                print(ans + 1)
                return
    print(ans)




if __name__ == '__main__':
    main()