# E - Bomber

from collections import Counter

h, w, m = map(int, input().split())
hw = [tuple(map(int, input().split())) for i in range(m)]

ys, xs = zip(*hw)
ymax, = Counter(ys).most_common(1)
xmax, = Counter(xs).most_common(1)

bombed = max(ymax[1], xmax[1])

if bombed < m:
    if ymax[1] > xmax[1]:
        xs = [b for a, b in hw if a != ymax[0]]
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        ys = [a for a, b in hw if b != xmax[0]]
        ymax, = Counter(ys).most_common(1)
        bombed += ymax[1]

print(bombed) from collections import Counter h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m tuple(map(int, input().split())) for i in range(m) for i in range(m) i range(m) range m for i in range(m) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split hw = [tuple(map(int, input().split())) for i in range(m)] hw [tuple(map(int, input().split())) for i in range(m)] ys, xs = zip(*hw) ys zip(*hw) zip *hw hw xs ymax, = Counter(ys).most_common(1) ymax Counter(ys).most_common(1) (ys).most_common (ys) Counter ys most_common 1 xmax, = Counter(xs).most_common(1) xmax Counter(xs).most_common(1) (xs).most_common (xs) Counter xs most_common 1 bombed = max(ymax[1], xmax[1]) bombed max(ymax[1], xmax[1]) max ymax[1] ymax 1 xmax[1] xmax 1 if bombed < m:
    if ymax[1] > xmax[1]:
        xs = [b for a, b in hw if a != ymax[0]]
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        ys = [a for a, b in hw if b != xmax[0]]
        ymax, = Counter(ys).most_common(1)
        bombed += ymax[1] bombed < m bombed m if ymax[1] > xmax[1]:
        xs = [b for a, b in hw if a != ymax[0]]
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        ys = [a for a, b in hw if b != xmax[0]]
        ymax, = Counter(ys).most_common(1)
        bombed += ymax[1] ymax[1] > xmax[1] ymax[1] ymax 1 xmax[1] xmax 1 b for a, b in hw if a != ymax[0] for a, b in hw if a != ymax[0] a b hw a != ymax[0] a ymax[0] ymax 0 if a != ymax[0] b xs = [b for a, b in hw if a != ymax[0]] xs [b for a, b in hw if a != ymax[0]] xmax, = Counter(xs).most_common(1) xmax Counter(xs).most_common(1) (xs).most_common (xs) Counter xs most_common 1 bombed += xmax[1] bombed xmax[1] xmax 1 a for a, b in hw if b != xmax[0] for a, b in hw if b != xmax[0] a b hw b != xmax[0] b xmax[0] xmax 0 if b != xmax[0] a ys = [a for a, b in hw if b != xmax[0]] ys [a for a, b in hw if b != xmax[0]] ymax, = Counter(ys).most_common(1) ymax Counter(ys).most_common(1) (ys).most_common (ys) Counter ys most_common 1 bombed += ymax[1] bombed ymax[1] ymax 1 print(bombed) print bombed w, m = map(int, input().split()) map(int, input().split()) w bombed = max(ymax[1], xmax[1]) max(ymax[1], xmax[1]) bombed ys, xs = zip(*hw) zip(*hw) ys ymax, = Counter(ys).most_common(1) Counter(ys).most_common(1) ymax bombed += xmax[1] xmax[1] bombed bombed += ymax[1] ymax[1] bombed xs = [b for a, b in hw if a != ymax[0]] [b for a, b in hw if a != ymax[0]] xs hw = [tuple(map(int, input().split())) for i in range(m)] [tuple(map(int, input().split())) for i in range(m)] hw xmax, = Counter(xs).most_common(1) Counter(xs).most_common(1) xmax m = map(int, input().split()) map(int, input().split()) m xmax, = Counter(xs).most_common(1) Counter(xs).most_common(1) xmax ys = [a for a, b in hw if b != xmax[0]] [a for a, b in hw if b != xmax[0]] ys xs = zip(*hw) zip(*hw) xs h, w, m = map(int, input().split()) map(int, input().split()) h ymax, = Counter(ys).most_common(1) Counter(ys).most_common(1) ymax
# E - Bomber

from collections import Counter

h, w, m = map(int, input().split())
hw = [tuple(map(int, input().split())) for i in range(m)]

ys, xs = zip(*hw)
ymax, = Counter(ys).most_common(1)
xmax, = Counter(xs).most_common(1)

bombed = max(ymax[1], xmax[1])

if bombed < m:
    if ymax[1] > xmax[1]:
        xs = [b for a, b in hw if a != ymax[0]]
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        ys = [a for a, b in hw if b != xmax[0]]
        ymax, = Counter(ys).most_common(1)
        bombed += ymax[1]

print(bombed)
