import numpy
H, W, M = [int(x) for x in input().split()]

width = numpy.array([0] * W, dtype='int64')
height = numpy.array([0] * H, dtype='int64')

obj = set()
for i in range(M):
    h, w = [int(x) - 1 for x in input().split()]

    width[w] += 1
    height[h] += 1
    obj.add((h, w))

result_h = set(numpy.where(height == numpy.max(height))[0])
result_w = set(numpy.where(width == numpy.max(width))[0])

if len(result_h) * len(result_w) > M:
    print(numpy.max(height) + numpy.max(width))
    exit()

for h in result_h:
    for w in result_w:
        if not (h, w) in obj:
            print(numpy.max(height) + numpy.max(width))
            exit()

print(numpy.max(height) + numpy.max(width) - 1) import numpy numpy int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x H, W, M = [int(x) for x in input().split()] H [int(x) for x in input().split()] W M width = numpy.array([0] * W, dtype='int64') width numpy.array([0] * W, dtype='int64') numpy.array numpy array [0] * W [0] 0 W dtype='int64' dtype 'int64' height = numpy.array([0] * H, dtype='int64') height numpy.array([0] * H, dtype='int64') numpy.array numpy array [0] * H [0] 0 H dtype='int64' dtype 'int64' obj = set() obj set() set for i in range(M):
    h, w = [int(x) - 1 for x in input().split()]

    width[w] += 1
    height[h] += 1
    obj.add((h, w)) i range(M) range M int(x) - 1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) - 1 int(x) int x 1 h, w = [int(x) - 1 for x in input().split()] h [int(x) - 1 for x in input().split()] w width[w] += 1 width[w] width w 1 height[h] += 1 height[h] height h 1 obj.add((h, w)) obj.add obj add (h, w) h w result_h = set(numpy.where(height == numpy.max(height))[0]) result_h set(numpy.where(height == numpy.max(height))[0]) set numpy.where(height == numpy.max(height))[0] numpy.where(height == numpy.max(height)) numpy.where numpy where height == numpy.max(height) height numpy.max(height) numpy.max numpy max height 0 result_w = set(numpy.where(width == numpy.max(width))[0]) result_w set(numpy.where(width == numpy.max(width))[0]) set numpy.where(width == numpy.max(width))[0] numpy.where(width == numpy.max(width)) numpy.where numpy where width == numpy.max(width) width numpy.max(width) numpy.max numpy max width 0 if len(result_h) * len(result_w) > M:
    print(numpy.max(height) + numpy.max(width))
    exit() len(result_h) * len(result_w) > M len(result_h) * len(result_w) len(result_h) len result_h len(result_w) len result_w M print(numpy.max(height) + numpy.max(width)) print numpy.max(height) + numpy.max(width) numpy.max(height) numpy.max numpy max height numpy.max(width) numpy.max numpy max width exit() exit for h in result_h:
    for w in result_w:
        if not (h, w) in obj:
            print(numpy.max(height) + numpy.max(width))
            exit() h result_h for w in result_w:
        if not (h, w) in obj:
            print(numpy.max(height) + numpy.max(width))
            exit() w result_w if not (h, w) in obj:
            print(numpy.max(height) + numpy.max(width))
            exit() not (h, w) in obj (h, w) in obj (h, w) h w obj print(numpy.max(height) + numpy.max(width)) print numpy.max(height) + numpy.max(width) numpy.max(height) numpy.max numpy max height numpy.max(width) numpy.max numpy max width exit() exit print(numpy.max(height) + numpy.max(width) - 1) print numpy.max(height) + numpy.max(width) - 1 numpy.max(height) + numpy.max(width) numpy.max(height) numpy.max numpy max height numpy.max(width) numpy.max numpy max width 1 W, M = [int(x) for x in input().split()] [int(x) for x in input().split()] W M = [int(x) for x in input().split()] [int(x) for x in input().split()] M obj = set() set() obj height = numpy.array([0] * H, dtype='int64') numpy.array([0] * H, dtype='int64') height w = [int(x) - 1 for x in input().split()] [int(x) - 1 for x in input().split()] w H, W, M = [int(x) for x in input().split()] [int(x) for x in input().split()] H h, w = [int(x) - 1 for x in input().split()] [int(x) - 1 for x in input().split()] h result_w = set(numpy.where(width == numpy.max(width))[0]) set(numpy.where(width == numpy.max(width))[0]) result_w result_h = set(numpy.where(height == numpy.max(height))[0]) set(numpy.where(height == numpy.max(height))[0]) result_h width = numpy.array([0] * W, dtype='int64') numpy.array([0] * W, dtype='int64') width
import numpy
H, W, M = [int(x) for x in input().split()]

width = numpy.array([0] * W, dtype='int64')
height = numpy.array([0] * H, dtype='int64')

obj = set()
for i in range(M):
    h, w = [int(x) - 1 for x in input().split()]

    width[w] += 1
    height[h] += 1
    obj.add((h, w))

result_h = set(numpy.where(height == numpy.max(height))[0])
result_w = set(numpy.where(width == numpy.max(width))[0])

if len(result_h) * len(result_w) > M:
    print(numpy.max(height) + numpy.max(width))
    exit()

for h in result_h:
    for w in result_w:
        if not (h, w) in obj:
            print(numpy.max(height) + numpy.max(width))
            exit()

print(numpy.max(height) + numpy.max(width) - 1)
