# 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]:
        hw2 = [(a, b) for a, b in hw if a != ymax[0]]
        _, xs = zip(*hw2)
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        hw2 = [(a, b) for a, b in hw if b != xmax[0]]
        ys, _ = zip(*hw2)
        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]:
        hw2 = [(a, b) for a, b in hw if a != ymax[0]]
        _, xs = zip(*hw2)
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        hw2 = [(a, b) for a, b in hw if b != xmax[0]]
        ys, _ = zip(*hw2)
        ymax, = Counter(ys).most_common(1)
        bombed += ymax[1] bombed < m bombed m if ymax[1] > xmax[1]:
        hw2 = [(a, b) for a, b in hw if a != ymax[0]]
        _, xs = zip(*hw2)
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        hw2 = [(a, b) for a, b in hw if b != xmax[0]]
        ys, _ = zip(*hw2)
        ymax, = Counter(ys).most_common(1)
        bombed += ymax[1] ymax[1] > xmax[1] ymax[1] ymax 1 xmax[1] xmax 1 (a, 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] (a, b) a b hw2 = [(a, b) for a, b in hw if a != ymax[0]] hw2 [(a, b) for a, b in hw if a != ymax[0]] _, xs = zip(*hw2) _ zip(*hw2) zip *hw2 hw2 xs 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, b) 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, b) a b hw2 = [(a, b) for a, b in hw if b != xmax[0]] hw2 [(a, b) for a, b in hw if b != xmax[0]] ys, _ = zip(*hw2) ys zip(*hw2) zip *hw2 hw2 _ 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 ymax, = Counter(ys).most_common(1) Counter(ys).most_common(1) ymax xs = zip(*hw2) zip(*hw2) xs h, w, m = map(int, input().split()) map(int, input().split()) h _, xs = zip(*hw2) zip(*hw2) _ hw2 = [(a, b) for a, b in hw if b != xmax[0]] [(a, b) for a, b in hw if b != xmax[0]] hw2 _ = zip(*hw2) zip(*hw2) _ bombed += ymax[1] ymax[1] bombed ys, xs = zip(*hw) zip(*hw) ys hw2 = [(a, b) for a, b in hw if a != ymax[0]] [(a, b) for a, b in hw if a != ymax[0]] hw2 bombed += xmax[1] xmax[1] bombed m = map(int, input().split()) map(int, input().split()) m xmax, = Counter(xs).most_common(1) Counter(xs).most_common(1) xmax ymax, = Counter(ys).most_common(1) Counter(ys).most_common(1) ymax bombed = max(ymax[1], xmax[1]) max(ymax[1], xmax[1]) bombed xmax, = Counter(xs).most_common(1) Counter(xs).most_common(1) xmax ys, _ = zip(*hw2) zip(*hw2) ys w, m = map(int, input().split()) map(int, input().split()) w hw = [tuple(map(int, input().split())) for i in range(m)] [tuple(map(int, input().split())) for i in range(m)] hw xs = zip(*hw) zip(*hw) xs
# 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]:
        hw2 = [(a, b) for a, b in hw if a != ymax[0]]
        _, xs = zip(*hw2)
        xmax, = Counter(xs).most_common(1)
        bombed += xmax[1]
    else:
        hw2 = [(a, b) for a, b in hw if b != xmax[0]]
        ys, _ = zip(*hw2)
        ymax, = Counter(ys).most_common(1)
        bombed += ymax[1]

print(bombed)
