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

hlist = [0]*H
wlist = [0]*W
sets = set()
for i in range (M):
    h,w = map(lambda x: int(x)-1,input().split())
    hlist[h]+=1
    wlist[w]+=1
    sets.add((h,w))

hmax = 0
hind = []
for i in range(H):
    if hmax < hlist[i]:
        hmax = hlist[i]
        hind = [i]
    elif hmax == hlist[i]:
        hind.append(i)


wmax = 0
wind = []
for i in range(W):
    if wmax < wlist[i]:
        wmax = wlist[i]
        wind = [i]
    elif wmax == wlist[i]:
        wind.append(i)


flag = False
for h in hind:
    for w in wind:
        if (h,w) not in sets:
            flag = True
            break
    if flag:
        break

if flag:
    print(hmax + wmax)
else:
    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 hlist = [0]*H hlist [0]*H [0] 0 H wlist = [0]*W wlist [0]*W [0] 0 W sets = set() sets set() set for i in range (M):
    h,w = map(lambda x: int(x)-1,input().split())
    hlist[h]+=1
    wlist[w]+=1
    sets.add((h,w)) i range (M) range M h,w = map(lambda x: int(x)-1,input().split()) h 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 w hlist[h]+=1 hlist[h] hlist h 1 wlist[w]+=1 wlist[w] wlist w 1 sets.add((h,w)) sets.add sets add (h,w) h w hmax = 0 hmax 0 hind = [] hind [] for i in range(H):
    if hmax < hlist[i]:
        hmax = hlist[i]
        hind = [i]
    elif hmax == hlist[i]:
        hind.append(i) i range(H) range H if hmax < hlist[i]:
        hmax = hlist[i]
        hind = [i]
    elif hmax == hlist[i]:
        hind.append(i) hmax < hlist[i] hmax hlist[i] hlist i hmax = hlist[i] hmax hlist[i] hlist i hind = [i] hind [i] i elif hmax == hlist[i]:
        hind.append(i) hmax == hlist[i] hmax hlist[i] hlist i hind.append(i) hind.append hind append i wmax = 0 wmax 0 wind = [] wind [] for i in range(W):
    if wmax < wlist[i]:
        wmax = wlist[i]
        wind = [i]
    elif wmax == wlist[i]:
        wind.append(i) i range(W) range W if wmax < wlist[i]:
        wmax = wlist[i]
        wind = [i]
    elif wmax == wlist[i]:
        wind.append(i) wmax < wlist[i] wmax wlist[i] wlist i wmax = wlist[i] wmax wlist[i] wlist i wind = [i] wind [i] i elif wmax == wlist[i]:
        wind.append(i) wmax == wlist[i] wmax wlist[i] wlist i wind.append(i) wind.append wind append i flag = False flag False for h in hind:
    for w in wind:
        if (h,w) not in sets:
            flag = True
            break
    if flag:
        break h hind for w in wind:
        if (h,w) not in sets:
            flag = True
            break
     w wind if (h,w) not in sets:
            flag = True
            break
     (h,w) not in sets (h,w) h w sets flag = True flag True break if flag:
        break flag break if flag:
    print(hmax + wmax)
else:
    print(hmax + wmax - 1) flag print(hmax + wmax) print hmax + wmax hmax wmax print(hmax + wmax - 1) print hmax + wmax - 1 hmax + wmax hmax wmax 1 hmax = hlist[i] hlist[i] hmax hmax = 0 0 hmax hind = [] [] hind wind = [] [] wind flag = True True flag flag = False False flag wlist = [0]*W [0]*W wlist hind = [i] [i] hind sets = set() set() sets wmax = wlist[i] wlist[i] wmax hlist = [0]*H [0]*H hlist h,w = map(lambda x: int(x)-1,input().split()) map(lambda x: int(x)-1,input().split()) h H,W,M = map(int,input().split()) map(int,input().split()) H wind = [i] [i] wind M = map(int,input().split()) map(int,input().split()) M w = map(lambda x: int(x)-1,input().split()) map(lambda x: int(x)-1,input().split()) w wmax = 0 0 wmax W,M = map(int,input().split()) map(int,input().split()) W
H,W,M = map(int,input().split())

hlist = [0]*H
wlist = [0]*W
sets = set()
for i in range (M):
    h,w = map(lambda x: int(x)-1,input().split())
    hlist[h]+=1
    wlist[w]+=1
    sets.add((h,w))

hmax = 0
hind = []
for i in range(H):
    if hmax < hlist[i]:
        hmax = hlist[i]
        hind = [i]
    elif hmax == hlist[i]:
        hind.append(i)


wmax = 0
wind = []
for i in range(W):
    if wmax < wlist[i]:
        wmax = wlist[i]
        wind = [i]
    elif wmax == wlist[i]:
        wind.append(i)


flag = False
for h in hind:
    for w in wind:
        if (h,w) not in sets:
            flag = True
            break
    if flag:
        break

if flag:
    print(hmax + wmax)
else:
    print(hmax + wmax - 1)
