import numpy as np
H,W,M = map(int,input().split())
#h = np.empty(M,dtype=np.int)
#w = np.empty(M,dtype=np.int)
bomb = set()
hh = np.zeros(H+1,dtype=np.int)
ww = np.zeros(W+1,dtype=np.int)

for i in range(M):
    h,w = map(int,input().split())
    bomb.add((h,w))
    hh[h] += 1
    ww[w] += 1

#print(bomb)
h_max = np.max(hh)
w_max = np.max(ww)

h_max_ids = list()
w_max_ids = list()
for i in range(1,H+1):
    if hh[i] == h_max:
      h_max_ids.append(i)
for j in range(1,W+1):
    if ww[j] == w_max:
      w_max_ids.append(j)
      
for i in h_max_ids:
  for j in w_max_ids:
    if not (i,j) in bomb:
      print(h_max + w_max)
      exit()

#print("hmax:{} wmax:{}".format(h_max_id, w_max_id))
#print("hmax:{} wmax:{}".format(hh[h_max_id], ww[w_max_id]))
print(h_max + w_max - 1) import numpy as np numpy H,W,M = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M bomb = set() bomb set() set hh = np.zeros(H+1,dtype=np.int) hh np.zeros(H+1,dtype=np.int) np.zeros np zeros H+1 H 1 dtype=np.int dtype np.int np int ww = np.zeros(W+1,dtype=np.int) ww np.zeros(W+1,dtype=np.int) np.zeros np zeros W+1 W 1 dtype=np.int dtype np.int np int for i in range(M):
    h,w = map(int,input().split())
    bomb.add((h,w))
    hh[h] += 1
    ww[w] += 1

#print(bomb) i range(M) range M h,w = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w bomb.add((h,w)) bomb.add bomb add (h,w) h w hh[h] += 1 hh[h] hh h 1 ww[w] += 1 ww[w] ww w 1 h_max = np.max(hh) h_max np.max(hh) np.max np max hh w_max = np.max(ww) w_max np.max(ww) np.max np max ww h_max_ids = list() h_max_ids list() list w_max_ids = list() w_max_ids list() list for i in range(1,H+1):
    if hh[i] == h_max:
      h_max_ids.append(i) i range(1,H+1) range 1 H+1 H 1 if hh[i] == h_max:
      h_max_ids.append(i) hh[i] == h_max hh[i] hh i h_max h_max_ids.append(i) h_max_ids.append h_max_ids append i for j in range(1,W+1):
    if ww[j] == w_max:
      w_max_ids.append(j)
       j range(1,W+1) range 1 W+1 W 1 if ww[j] == w_max:
      w_max_ids.append(j)
       ww[j] == w_max ww[j] ww j w_max w_max_ids.append(j) w_max_ids.append w_max_ids append j for i in h_max_ids:
  for j in w_max_ids:
    if not (i,j) in bomb:
      print(h_max + w_max)
      exit()

#print("hmax:{} wmax:{}".format(h_max_id, w_max_id))
#print("hmax:{} wmax:{}".format(hh[h_max_id], ww[w_max_id])) i h_max_ids for j in w_max_ids:
    if not (i,j) in bomb:
      print(h_max + w_max)
      exit()

#print("hmax:{} wmax:{}".format(h_max_id, w_max_id))
#print("hmax:{} wmax:{}".format(hh[h_max_id], ww[w_max_id])) j w_max_ids if not (i,j) in bomb:
      print(h_max + w_max)
      exit()

#print("hmax:{} wmax:{}".format(h_max_id, w_max_id))
#print("hmax:{} wmax:{}".format(hh[h_max_id], ww[w_max_id])) not (i,j) in bomb (i,j) in bomb (i,j) i j bomb print(h_max + w_max) print h_max + w_max h_max w_max exit() exit print(h_max + w_max - 1) print h_max + w_max - 1 h_max + w_max h_max w_max 1 bomb = set() set() bomb W,M = map(int,input().split()) map(int,input().split()) W ww = np.zeros(W+1,dtype=np.int) np.zeros(W+1,dtype=np.int) ww w = map(int,input().split()) map(int,input().split()) w h_max_ids = list() list() h_max_ids H,W,M = map(int,input().split()) map(int,input().split()) H M = map(int,input().split()) map(int,input().split()) M w_max_ids = list() list() w_max_ids hh = np.zeros(H+1,dtype=np.int) np.zeros(H+1,dtype=np.int) hh w_max = np.max(ww) np.max(ww) w_max h,w = map(int,input().split()) map(int,input().split()) h h_max = np.max(hh) np.max(hh) h_max
import numpy as np
H,W,M = map(int,input().split())
#h = np.empty(M,dtype=np.int)
#w = np.empty(M,dtype=np.int)
bomb = set()
hh = np.zeros(H+1,dtype=np.int)
ww = np.zeros(W+1,dtype=np.int)

for i in range(M):
    h,w = map(int,input().split())
    bomb.add((h,w))
    hh[h] += 1
    ww[w] += 1

#print(bomb)
h_max = np.max(hh)
w_max = np.max(ww)

h_max_ids = list()
w_max_ids = list()
for i in range(1,H+1):
    if hh[i] == h_max:
      h_max_ids.append(i)
for j in range(1,W+1):
    if ww[j] == w_max:
      w_max_ids.append(j)
      
for i in h_max_ids:
  for j in w_max_ids:
    if not (i,j) in bomb:
      print(h_max + w_max)
      exit()

#print("hmax:{} wmax:{}".format(h_max_id, w_max_id))
#print("hmax:{} wmax:{}".format(hh[h_max_id], ww[w_max_id]))
print(h_max + w_max - 1)
