import sys
input = sys.stdin.readline

h, w, m = map(int,input().split())

row = [0]*h
col = [0]*w
enemy = []

for i in range(m):
    hh, ww = map(lambda x:int(x)-1,input().split())
    row[hh] += 1
    col[ww] += 1
    enemy.append((hh,ww))

enemy = set(enemy)
rmax = max(row)
cmax = max(col)

on_r = row.count(rmax)
on_c = col.count(cmax)

on = 0
for hh, ww in enemy:
    if row[hh] == rmax and col[ww] == cmax:
        on += 1
if on == on_r*on_c:
    print(rmax+cmax-1)
else:
    print(rmax+cmax) 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 row = [0]*h row [0]*h [0] 0 h col = [0]*w col [0]*w [0] 0 w enemy = [] enemy [] for i in range(m):
    hh, ww = map(lambda x:int(x)-1,input().split())
    row[hh] += 1
    col[ww] += 1
    enemy.append((hh,ww)) i range(m) range m hh, ww = map(lambda x:int(x)-1,input().split()) hh map(lambda x:int(x)-1,input().split()) map lambda x:int(x)-1 int(x)-1 int(x) int x 1 x input().split() ().split () input split ww row[hh] += 1 row[hh] row hh 1 col[ww] += 1 col[ww] col ww 1 enemy.append((hh,ww)) enemy.append enemy append (hh,ww) hh ww enemy = set(enemy) enemy set(enemy) set enemy rmax = max(row) rmax max(row) max row cmax = max(col) cmax max(col) max col on_r = row.count(rmax) on_r row.count(rmax) row.count row count rmax on_c = col.count(cmax) on_c col.count(cmax) col.count col count cmax on = 0 on 0 for hh, ww in enemy:
    if row[hh] == rmax and col[ww] == cmax:
        on += 1 hh ww enemy if row[hh] == rmax and col[ww] == cmax:
        on += 1 row[hh] == rmax and col[ww] == cmax row[hh] == rmax row[hh] row hh rmax col[ww] == cmax col[ww] col ww cmax on += 1 on 1 if on == on_r*on_c:
    print(rmax+cmax-1)
else:
    print(rmax+cmax) on == on_r*on_c on on_r*on_c on_r on_c print(rmax+cmax-1) print rmax+cmax-1 rmax+cmax rmax cmax 1 print(rmax+cmax) print rmax+cmax rmax cmax on += 1 1 on m = map(int,input().split()) map(int,input().split()) m col = [0]*w [0]*w col rmax = max(row) max(row) rmax hh, ww = map(lambda x:int(x)-1,input().split()) map(lambda x:int(x)-1,input().split()) hh input = sys.stdin.readline sys.stdin.readline input enemy = set(enemy) set(enemy) enemy row = [0]*h [0]*h row on_r = row.count(rmax) row.count(rmax) on_r h, w, m = map(int,input().split()) map(int,input().split()) h w, m = map(int,input().split()) map(int,input().split()) w on_c = col.count(cmax) col.count(cmax) on_c on = 0 0 on cmax = max(col) max(col) cmax ww = map(lambda x:int(x)-1,input().split()) map(lambda x:int(x)-1,input().split()) ww enemy = [] [] enemy
import sys
input = sys.stdin.readline

h, w, m = map(int,input().split())

row = [0]*h
col = [0]*w
enemy = []

for i in range(m):
    hh, ww = map(lambda x:int(x)-1,input().split())
    row[hh] += 1
    col[ww] += 1
    enemy.append((hh,ww))

enemy = set(enemy)
rmax = max(row)
cmax = max(col)

on_r = row.count(rmax)
on_c = col.count(cmax)

on = 0
for hh, ww in enemy:
    if row[hh] == rmax and col[ww] == cmax:
        on += 1
if on == on_r*on_c:
    print(rmax+cmax-1)
else:
    print(rmax+cmax)