#https://atcoder.jp/contests/abc176/submissions/16118386
import collections
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
H,W,M=map(int,input().split())
A=list()
B=list()
for i in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
c = collections.Counter(A)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if A[i]!=k:
    L.append(B[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  ans=s[0][1]+t
else:
  ans=t
c = collections.Counter(B)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if B[i]!=k:
    L.append(A[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  q=s[0][1]+t
else:
  q=t
ans=max(ans,q)
print(ans) import collections collections import sys sys import math math sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 def input() : return sys.stdin.readline().strip() input def INT()   : return int(input()) INT def MAP()   : return map(int,input().split()) MAP def LIST()  : return list(MAP()) LIST list(input()) for i in range(H) for i in range(H) i range(H) range H for i in range(H) list(input()) list input() input def NIJIGEN(H): return [list(input()) for i in range(H)] NIJIGEN H H H,W,M=map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M A=list() A list() list B=list() B list() list for i in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b) i range(M) range M a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b A.append(a) A.append A append a B.append(b) B.append B append b c = collections.Counter(A) c collections.Counter(A) collections.Counter collections Counter A s=c.most_common() s c.most_common() c.most_common c most_common k=s[0][0] k s[0][0] [0] s 0 0 t=s[0][1] t s[0][1] [0] s 0 1 L=list() L list() list for i in range(M):
  if A[i]!=k:
    L.append(B[i]) i range(M) range M if A[i]!=k:
    L.append(B[i]) A[i]!=k A[i] A i k L.append(B[i]) L.append L append B[i] B i c = collections.Counter(L) c collections.Counter(L) collections.Counter collections Counter L s=c.most_common() s c.most_common() c.most_common c most_common if len(s)!=0:
  ans=s[0][1]+t
else:
  ans=t len(s)!=0 len(s) len s 0 ans=s[0][1]+t ans s[0][1]+t s[0][1] [0] s 0 1 t ans=t ans t c = collections.Counter(B) c collections.Counter(B) collections.Counter collections Counter B s=c.most_common() s c.most_common() c.most_common c most_common k=s[0][0] k s[0][0] [0] s 0 0 t=s[0][1] t s[0][1] [0] s 0 1 L=list() L list() list for i in range(M):
  if B[i]!=k:
    L.append(A[i]) i range(M) range M if B[i]!=k:
    L.append(A[i]) B[i]!=k B[i] B i k L.append(A[i]) L.append L append A[i] A i c = collections.Counter(L) c collections.Counter(L) collections.Counter collections Counter L s=c.most_common() s c.most_common() c.most_common c most_common if len(s)!=0:
  q=s[0][1]+t
else:
  q=t len(s)!=0 len(s) len s 0 q=s[0][1]+t q s[0][1]+t s[0][1] [0] s 0 1 t q=t q t ans=max(ans,q) ans max(ans,q) max ans q print(ans) print ans s=c.most_common() c.most_common() s L=list() list() L a,b=map(int,input().split()) map(int,input().split()) a def INT()   : return int(input()) def INT()   : return int(input()) INT k=s[0][0] s[0][0] k c = collections.Counter(L) collections.Counter(L) c def input() : return sys.stdin.readline().strip() def input() : return sys.stdin.readline().strip() input t=s[0][1] s[0][1] t ans=t t ans s=c.most_common() c.most_common() s c = collections.Counter(A) collections.Counter(A) c ans=s[0][1]+t s[0][1]+t ans q=t t q def LIST()  : return list(MAP()) def LIST()  : return list(MAP()) LIST A=list() list() A b=map(int,input().split()) map(int,input().split()) b B=list() list() B s=c.most_common() c.most_common() s W,M=map(int,input().split()) map(int,input().split()) W q=s[0][1]+t s[0][1]+t q def NIJIGEN(H): return [list(input()) for i in range(H)] def NIJIGEN(H): return [list(input()) for i in range(H)] NIJIGEN L=list() list() L H,W,M=map(int,input().split()) map(int,input().split()) H ans=max(ans,q) max(ans,q) ans k=s[0][0] s[0][0] k c = collections.Counter(L) collections.Counter(L) c def MAP()   : return map(int,input().split()) def MAP()   : return map(int,input().split()) MAP M=map(int,input().split()) map(int,input().split()) M c = collections.Counter(B) collections.Counter(B) c s=c.most_common() c.most_common() s t=s[0][1] s[0][1] t
#https://atcoder.jp/contests/abc176/submissions/16118386
import collections
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
H,W,M=map(int,input().split())
A=list()
B=list()
for i in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
c = collections.Counter(A)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if A[i]!=k:
    L.append(B[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  ans=s[0][1]+t
else:
  ans=t
c = collections.Counter(B)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if B[i]!=k:
    L.append(A[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  q=s[0][1]+t
else:
  q=t
ans=max(ans,q)
print(ans)