from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

h,w,m = readInts()
countx = defaultdict(set)
county = defaultdict(set)
cx,cy = defaultdict(int),defaultdict(int)
for i in range(m):
	x,y = readInts()
	countx[x].add(y)
	county[y].add(x)
	cx[x]+=1
	cy[y]+=1

maxxv = max(cx.values())
maxyv = max(cy.values())
maxxi = [i for i in countx if len(countx[i])==maxxv]
maxyi = [i for i in county if len(county[i])==maxyv]

ans = maxyv+maxxv

for i in maxxi:
	for j in maxyi:
		if j not in countx[i]:
			print(ans)
			exit()

print(ans-1) from collections import defaultdict from collections import deque from collections import Counter import math math def readInt():
	return int(input()) readInt return int(input()) int(input()) int input() input def readInts():
	return list(map(int, input().split())) readInts return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def readChar():
	return input() readChar return input() input() input def readChars():
	return input().split() readChars return input().split() input().split() ().split () input split h,w,m = readInts() h readInts() readInts w m countx = defaultdict(set) countx defaultdict(set) defaultdict set county = defaultdict(set) county defaultdict(set) defaultdict set cx,cy = defaultdict(int),defaultdict(int) cx defaultdict(int) defaultdict int cy defaultdict(int) defaultdict int for i in range(m):
	x,y = readInts()
	countx[x].add(y)
	county[y].add(x)
	cx[x]+=1
	cy[y]+=1 i range(m) range m x,y = readInts() x readInts() readInts y countx[x].add(y) [x].add [x] countx x add y county[y].add(x) [y].add [y] county y add x cx[x]+=1 cx[x] cx x 1 cy[y]+=1 cy[y] cy y 1 maxxv = max(cx.values()) maxxv max(cx.values()) max cx.values() cx.values cx values maxyv = max(cy.values()) maxyv max(cy.values()) max cy.values() cy.values cy values i for i in countx if len(countx[i])==maxxv for i in countx if len(countx[i])==maxxv i countx len(countx[i])==maxxv len(countx[i]) len countx[i] countx i maxxv if len(countx[i])==maxxv i maxxi = [i for i in countx if len(countx[i])==maxxv] maxxi [i for i in countx if len(countx[i])==maxxv] i for i in county if len(county[i])==maxyv for i in county if len(county[i])==maxyv i county len(county[i])==maxyv len(county[i]) len county[i] county i maxyv if len(county[i])==maxyv i maxyi = [i for i in county if len(county[i])==maxyv] maxyi [i for i in county if len(county[i])==maxyv] ans = maxyv+maxxv ans maxyv+maxxv maxyv maxxv for i in maxxi:
	for j in maxyi:
		if j not in countx[i]:
			print(ans)
			exit() i maxxi for j in maxyi:
		if j not in countx[i]:
			print(ans)
			exit() j maxyi if j not in countx[i]:
			print(ans)
			exit() j not in countx[i] j countx[i] countx i print(ans) print ans exit() exit print(ans-1) print ans-1 ans 1 maxxi = [i for i in countx if len(countx[i])==maxxv] [i for i in countx if len(countx[i])==maxxv] maxxi maxyi = [i for i in county if len(county[i])==maxyv] [i for i in county if len(county[i])==maxyv] maxyi x,y = readInts() readInts() x cy = defaultdict(int),defaultdict(int) defaultdict(int) cy def readInts():
	return list(map(int, input().split())) def readInts():
	return list(map(int, input().split())) readInts countx = defaultdict(set) defaultdict(set) countx maxyv = max(cy.values()) max(cy.values()) maxyv maxxv = max(cx.values()) max(cx.values()) maxxv def readInt():
	return int(input()) def readInt():
	return int(input()) readInt m = readInts() readInts() m county = defaultdict(set) defaultdict(set) county y = readInts() readInts() y def readChar():
	return input() def readChar():
	return input() readChar def readChars():
	return input().split() def readChars():
	return input().split() readChars cx,cy = defaultdict(int),defaultdict(int) defaultdict(int) cx ans = maxyv+maxxv maxyv+maxxv ans h,w,m = readInts() readInts() h w,m = readInts() readInts() w
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

h,w,m = readInts()
countx = defaultdict(set)
county = defaultdict(set)
cx,cy = defaultdict(int),defaultdict(int)
for i in range(m):
	x,y = readInts()
	countx[x].add(y)
	county[y].add(x)
	cx[x]+=1
	cy[y]+=1

maxxv = max(cx.values())
maxyv = max(cy.values())
maxxi = [i for i in countx if len(countx[i])==maxxv]
maxyi = [i for i in county if len(county[i])==maxyv]

ans = maxyv+maxxv

for i in maxxi:
	for j in maxyi:
		if j not in countx[i]:
			print(ans)
			exit()

print(ans-1)