H, W, M = map(int, input().split())

sumh = [0] * W
sumw = [0] * H
checkset = set()
for i in range(M):
    h, w = map(int, input().split())
    checkset.add((h-1, w-1))
    sumh[w-1] += 1
    sumw[h-1] += 1
shmax = max(sumh)
swmax = max(sumw)
sh = []
sw = []
for i, s in enumerate(sumh):
    if s == shmax: sh.append(i)
for i, s in enumerate(sumw):
    if s == swmax: sw.append(i)
ans = shmax + swmax - 1
jdg = False
for i in sh:
    for j in sw:
        if (j, i) not in checkset: 
            ans += 1
            jdg = True
            break

    if jdg: break
print(ans) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M sumh = [0] * W sumh [0] * W [0] 0 W sumw = [0] * H sumw [0] * H [0] 0 H checkset = set() checkset set() set for i in range(M):
    h, w = map(int, input().split())
    checkset.add((h-1, w-1))
    sumh[w-1] += 1
    sumw[h-1] += 1 i range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w checkset.add((h-1, w-1)) checkset.add checkset add (h-1, w-1) h-1 h 1 w-1 w 1 sumh[w-1] += 1 sumh[w-1] sumh w-1 w 1 1 sumw[h-1] += 1 sumw[h-1] sumw h-1 h 1 1 shmax = max(sumh) shmax max(sumh) max sumh swmax = max(sumw) swmax max(sumw) max sumw sh = [] sh [] sw = [] sw [] for i, s in enumerate(sumh):
    if s == shmax: sh.append(i) i s enumerate(sumh) enumerate sumh if s == shmax: sh.appen s == shmax s shmax for i, s in enumerate(sumw):
    if s == swmax: sw.append(i) i s enumerate(sumw) enumerate sumw if s == swmax: sw.appen s == swmax s swmax ans = shmax + swmax - 1 ans shmax + swmax - 1 shmax + swmax shmax swmax 1 jdg = False jdg False for i in sh:
    for j in sw:
        if (j, i) not in checkset: 
            ans += 1
            jdg = True
            break

    if jdg: break i sh for j in sw:
        if (j, i) not in checkset: 
            ans += 1
            jdg = True
            break

     j sw if (j, i) not in checkset: 
            ans += 1
            jdg = True
            break

     (j, i) not in checkset (j, i) j i checkset ans += 1 ans 1 jdg = True jdg True break if jdg: b jdg print(ans) print ans shmax = max(sumh) max(sumh) shmax checkset = set() set() checkset sh = [] [] sh M = map(int, input().split()) map(int, input().split()) M sw = [] [] sw jdg = True True jdg W, M = map(int, input().split()) map(int, input().split()) W sumh = [0] * W [0] * W sumh h, w = map(int, input().split()) map(int, input().split()) h H, W, M = map(int, input().split()) map(int, input().split()) H ans = shmax + swmax - 1 shmax + swmax - 1 ans jdg = False False jdg ans += 1 1 ans w = map(int, input().split()) map(int, input().split()) w swmax = max(sumw) max(sumw) swmax sumw = [0] * H [0] * H sumw
H, W, M = map(int, input().split())

sumh = [0] * W
sumw = [0] * H
checkset = set()
for i in range(M):
    h, w = map(int, input().split())
    checkset.add((h-1, w-1))
    sumh[w-1] += 1
    sumw[h-1] += 1
shmax = max(sumh)
swmax = max(sumw)
sh = []
sw = []
for i, s in enumerate(sumh):
    if s == shmax: sh.append(i)
for i, s in enumerate(sumw):
    if s == swmax: sw.append(i)
ans = shmax + swmax - 1
jdg = False
for i in sh:
    for j in sw:
        if (j, i) not in checkset: 
            ans += 1
            jdg = True
            break

    if jdg: break
print(ans)
