import sys
input = sys.stdin.readline
H, W, M = map(int, input().split())


vert = [0] * (2*W)

def update(i, d):
	i += W
	vert[i] += d
	while i > 1:
		i >>= 1
		vert[i] = max(vert[i*2], vert[i*2+1])


lines = [[] for _ in range(H)]
for _ in range(M):
	y, x = map(lambda s: int(s)-1, input().split())
	lines[y].append(x)
	update(x, 1)

best = 0

for l in lines:
	for x in l: update(x, -1)
	best = max(best, len(l) + vert[1])
	for x in l: update(x, 1)

print(best) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M vert = [0] * (2*W) vert [0] * (2*W) [0] 0 2*W 2 W def update(i, d):
	i += W
	vert[i] += d
	while i > 1:
		i >>= 1
		vert[i] = max(vert[i*2], vert[i*2+1]) update i += W i W vert[i] += d vert[i] vert i d while i > 1:
		i >>= 1
		vert[i] = max(vert[i*2], vert[i*2+1]) i > 1 i 1 i >>= 1 i 1 vert[i] = max(vert[i*2], vert[i*2+1]) vert[i] vert i max(vert[i*2], vert[i*2+1]) max vert[i*2] vert i*2 i 2 vert[i*2+1] vert i*2+1 i*2 i 2 1 i i d d [] for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [] lines = [[] for _ in range(H)] lines [[] for _ in range(H)] for _ in range(M):
	y, x = map(lambda s: int(s)-1, input().split())
	lines[y].append(x)
	update(x, 1) _ range(M) range M y, x = map(lambda s: int(s)-1, input().split()) y map(lambda s: int(s)-1, input().split()) map lambda s: int(s)-1 int(s)-1 int(s) int s 1 s input().split() ().split () input split x lines[y].append(x) [y].append [y] lines y append x update(x, 1) update x 1 best = 0 best 0 for l in lines:
	for x in l: update(x, -1)
	best = max(best, len(l) + vert[1])
	for x in l: update(x, 1) l lines for x in l: update(x, -1)
	 x l best = max(best, len(l) + vert[1]) best max(best, len(l) + vert[1]) max best len(l) + vert[1] len(l) len l vert[1] vert 1 for x in l: update(x, 1 x l print(best) print best vert = [0] * (2*W) [0] * (2*W) vert lines = [[] for _ in range(H)] [[] for _ in range(H)] lines input = sys.stdin.readline sys.stdin.readline input W, M = map(int, input().split()) map(int, input().split()) W y, x = map(lambda s: int(s)-1, input().split()) map(lambda s: int(s)-1, input().split()) y best = 0 0 best def update(i, d):
	i += W
	vert[i] += d
	while i > 1:
		i >>= 1
		vert[i] = max(vert[i*2], vert[i*2+1]) def update(i, d):
	i += W
	vert[i] += d
	while i > 1:
		i >>= 1
		vert[i] = max(vert[i*2], vert[i*2+1]) update x = map(lambda s: int(s)-1, input().split()) map(lambda s: int(s)-1, input().split()) x M = map(int, input().split()) map(int, input().split()) M H, W, M = map(int, input().split()) map(int, input().split()) H best = max(best, len(l) + vert[1]) max(best, len(l) + vert[1]) best
import sys
input = sys.stdin.readline
H, W, M = map(int, input().split())


vert = [0] * (2*W)

def update(i, d):
	i += W
	vert[i] += d
	while i > 1:
		i >>= 1
		vert[i] = max(vert[i*2], vert[i*2+1])


lines = [[] for _ in range(H)]
for _ in range(M):
	y, x = map(lambda s: int(s)-1, input().split())
	lines[y].append(x)
	update(x, 1)

best = 0

for l in lines:
	for x in l: update(x, -1)
	best = max(best, len(l) + vert[1])
	for x in l: update(x, 1)

print(best)
