import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


H, W, M = MI()
h = [0] * H
w = [0] * W
item_list = [[0, 0] for _ in range(M)]

for i in range(M):
    item_h, item_w = MI()
    item_h -= 1
    item_w -= 1
    h[item_h] += 1
    w[item_w] += 1
    item_list[i][0] = item_h
    item_list[i][1] = item_w

h_max = max(h)
w_max = max(w)
h_cnt = h.count(h_max)
w_cnt = w.count(w_max)
ans = h_max + w_max

cnt = 0
for item in item_list:
    if h[item[0]] == h_max and w[item[1]] == w_max:
        cnt += 1

x = h_cnt * w_cnt
if cnt == x:
    ans -= 1

print(ans) import bisect, collections, copy, heapq, itertools, math, string bisect collections copy heapq itertools math string import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS H, W, M = MI() H MI() MI W M h = [0] * H h [0] * H [0] 0 H w = [0] * W w [0] * W [0] 0 W [0, 0] for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) [0, 0] 0 0 item_list = [[0, 0] for _ in range(M)] item_list [[0, 0] for _ in range(M)] for i in range(M):
    item_h, item_w = MI()
    item_h -= 1
    item_w -= 1
    h[item_h] += 1
    w[item_w] += 1
    item_list[i][0] = item_h
    item_list[i][1] = item_w i range(M) range M item_h, item_w = MI() item_h MI() MI item_w item_h -= 1 item_h 1 item_w -= 1 item_w 1 h[item_h] += 1 h[item_h] h item_h 1 w[item_w] += 1 w[item_w] w item_w 1 item_list[i][0] = item_h item_list[i][0] [i] item_list i 0 item_h item_list[i][1] = item_w item_list[i][1] [i] item_list i 1 item_w h_max = max(h) h_max max(h) max h w_max = max(w) w_max max(w) max w h_cnt = h.count(h_max) h_cnt h.count(h_max) h.count h count h_max w_cnt = w.count(w_max) w_cnt w.count(w_max) w.count w count w_max ans = h_max + w_max ans h_max + w_max h_max w_max cnt = 0 cnt 0 for item in item_list:
    if h[item[0]] == h_max and w[item[1]] == w_max:
        cnt += 1 item item_list if h[item[0]] == h_max and w[item[1]] == w_max:
        cnt += 1 h[item[0]] == h_max and w[item[1]] == w_max h[item[0]] == h_max h[item[0]] h item[0] item 0 h_max w[item[1]] == w_max w[item[1]] w item[1] item 1 w_max cnt += 1 cnt 1 x = h_cnt * w_cnt x h_cnt * w_cnt h_cnt w_cnt if cnt == x:
    ans -= 1 cnt == x cnt x ans -= 1 ans 1 print(ans) print ans def MI(): return map(int, sys.stdin.readline().rstrip().split()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI item_list = [[0, 0] for _ in range(M)] [[0, 0] for _ in range(M)] item_list item_w = MI() MI() item_w h_cnt = h.count(h_max) h.count(h_max) h_cnt cnt = 0 0 cnt ans = h_max + w_max h_max + w_max ans cnt += 1 1 cnt def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S item_w -= 1 1 item_w def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI M = MI() MI() M item_h -= 1 1 item_h h_max = max(h) max(h) h_max ans -= 1 1 ans W, M = MI() MI() W w_cnt = w.count(w_max) w.count(w_max) w_cnt w = [0] * W [0] * W w x = h_cnt * w_cnt h_cnt * w_cnt x H, W, M = MI() MI() H w_max = max(w) max(w) w_max def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I h = [0] * H [0] * H h def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS item_h, item_w = MI() MI() item_h
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


H, W, M = MI()
h = [0] * H
w = [0] * W
item_list = [[0, 0] for _ in range(M)]

for i in range(M):
    item_h, item_w = MI()
    item_h -= 1
    item_w -= 1
    h[item_h] += 1
    w[item_w] += 1
    item_list[i][0] = item_h
    item_list[i][1] = item_w

h_max = max(h)
w_max = max(w)
h_cnt = h.count(h_max)
w_cnt = w.count(w_max)
ans = h_max + w_max

cnt = 0
for item in item_list:
    if h[item[0]] == h_max and w[item[1]] == w_max:
        cnt += 1

x = h_cnt * w_cnt
if cnt == x:
    ans -= 1

print(ans)
