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

h_list = [0 for i in range(H)]
w_list = [0 for i in range(W)]

point = {}
for _ in range(M):
    h, w = map(int, input().split())
    h_list[h - 1] += 1
    w_list[w - 1] += 1
    point[(h - 1, w - 1)] = 1

hmax = 0
wmax = 0
hmap = {}
wmap = {}
for i, h in enumerate(h_list):
    if hmax <= h:
        hmax = h
        hmap.setdefault(h, []).append(i)
for i, w in enumerate(w_list):
    if wmax <= w:
        wmax = w
        wmap.setdefault(w, []).append(i)
# print(hmap)
# print(wmap)
# hmax = max(h_list)
# wmax = max(w_list)
h_index = h_list.index(hmax)
w_index = w_list.index(wmax)

for h in hmap[hmax]:
    for w in wmap[wmax]:
        if (h, w) not in point:
            print(hmax + wmax)
            exit(0)

print(hmax + wmax - 1) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M 0 for i in range(H) for i in range(H) i range(H) range H for i in range(H) 0 h_list = [0 for i in range(H)] h_list [0 for i in range(H)] 0 for i in range(W) for i in range(W) i range(W) range W for i in range(W) 0 w_list = [0 for i in range(W)] w_list [0 for i in range(W)] point = {} point {} for _ in range(M):
    h, w = map(int, input().split())
    h_list[h - 1] += 1
    w_list[w - 1] += 1
    point[(h - 1, w - 1)] = 1 _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h_list[h - 1] += 1 h_list[h - 1] h_list h - 1 h 1 1 w_list[w - 1] += 1 w_list[w - 1] w_list w - 1 w 1 1 point[(h - 1, w - 1)] = 1 point[(h - 1, w - 1)] point (h - 1, w - 1) h - 1 h 1 w - 1 w 1 1 hmax = 0 hmax 0 wmax = 0 wmax 0 hmap = {} hmap {} wmap = {} wmap {} for i, h in enumerate(h_list):
    if hmax <= h:
        hmax = h
        hmap.setdefault(h, []).append(i) i h enumerate(h_list) enumerate h_list if hmax <= h:
        hmax = h
        hmap.setdefault(h, []).append(i) hmax <= h hmax h hmax = h hmax h hmap.setdefault(h, []).append(i) hmap.setdefault(h, []).append hmap.setdefault(h, []) hmap.setdefault hmap setdefault h [] append i for i, w in enumerate(w_list):
    if wmax <= w:
        wmax = w
        wmap.setdefault(w, []).append(i)
# print(hmap)
# print(wmap)
# hmax = max(h_list)
# wmax = max(w_list) i w enumerate(w_list) enumerate w_list if wmax <= w:
        wmax = w
        wmap.setdefault(w, []).append(i)
# print(hmap)
# print(wmap)
# hmax = max(h_list)
# wmax = max(w_list) wmax <= w wmax w wmax = w wmax w wmap.setdefault(w, []).append(i) wmap.setdefault(w, []).append wmap.setdefault(w, []) wmap.setdefault wmap setdefault w [] append i h_index = h_list.index(hmax) h_index h_list.index(hmax) h_list.index h_list index hmax w_index = w_list.index(wmax) w_index w_list.index(wmax) w_list.index w_list index wmax for h in hmap[hmax]:
    for w in wmap[wmax]:
        if (h, w) not in point:
            print(hmax + wmax)
            exit(0) h hmap[hmax] hmap hmax for w in wmap[wmax]:
        if (h, w) not in point:
            print(hmax + wmax)
            exit(0) w wmap[wmax] wmap wmax if (h, w) not in point:
            print(hmax + wmax)
            exit(0) (h, w) not in point (h, w) h w point print(hmax + wmax) print hmax + wmax hmax wmax exit(0) exit 0 print(hmax + wmax - 1) print hmax + wmax - 1 hmax + wmax hmax wmax 1 h_list = [0 for i in range(H)] [0 for i in range(H)] h_list w = map(int, input().split()) map(int, input().split()) w W, M = map(int, input().split()) map(int, input().split()) W hmax = 0 0 hmax point = {} {} point h_index = h_list.index(hmax) h_list.index(hmax) h_index wmap = {} {} wmap hmax = h h hmax wmax = w w wmax M = map(int, input().split()) map(int, input().split()) M h, w = map(int, input().split()) map(int, input().split()) h w_index = w_list.index(wmax) w_list.index(wmax) w_index H, W, M = map(int, input().split()) map(int, input().split()) H w_list = [0 for i in range(W)] [0 for i in range(W)] w_list wmax = 0 0 wmax hmap = {} {} hmap
H, W, M = map(int, input().split())

h_list = [0 for i in range(H)]
w_list = [0 for i in range(W)]

point = {}
for _ in range(M):
    h, w = map(int, input().split())
    h_list[h - 1] += 1
    w_list[w - 1] += 1
    point[(h - 1, w - 1)] = 1

hmax = 0
wmax = 0
hmap = {}
wmap = {}
for i, h in enumerate(h_list):
    if hmax <= h:
        hmax = h
        hmap.setdefault(h, []).append(i)
for i, w in enumerate(w_list):
    if wmax <= w:
        wmax = w
        wmap.setdefault(w, []).append(i)
# print(hmap)
# print(wmap)
# hmax = max(h_list)
# wmax = max(w_list)
h_index = h_list.index(hmax)
w_index = w_list.index(wmax)

for h in hmap[hmax]:
    for w in wmap[wmax]:
        if (h, w) not in point:
            print(hmax + wmax)
            exit(0)

print(hmax + wmax - 1)