h,w,m = map(int,input().split())
s = set([])
H = [0]*(h+1)
W = [0]*(w+1)
for i in range(m):
    x,y = map(int,input().split())
    H[x] += 1
    W[y] += 1
    s.add((x,y))
    
p = [0]*(h+1)
q = [0]*(w+1)
for i in range(h+1):
    p[i] = [i, H[i]]
for i in range(w+1):
    q[i] = [i, W[i]]
    
p.sort(key= lambda val : val[1],reverse=True)
q.sort(key= lambda val : val[1],reverse=True)

mh = max(H)
mw = max(W)
I = H.count(mh)
J = W.count(mw)

sw = 0
for i in range(I):
    if sw == 1:
        break
    for j in range(J):
        if (p[i][0], q[j][0]) in s:
            pass
        else:
            sw = 1
            break

print(mh+mw-1+sw) h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m s = set([]) s set([]) set [] H = [0]*(h+1) H [0]*(h+1) [0] 0 h+1 h 1 W = [0]*(w+1) W [0]*(w+1) [0] 0 w+1 w 1 for i in range(m):
    x,y = map(int,input().split())
    H[x] += 1
    W[y] += 1
    s.add((x,y))
     i range(m) range m x,y = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y H[x] += 1 H[x] H x 1 W[y] += 1 W[y] W y 1 s.add((x,y)) s.add s add (x,y) x y p = [0]*(h+1) p [0]*(h+1) [0] 0 h+1 h 1 q = [0]*(w+1) q [0]*(w+1) [0] 0 w+1 w 1 for i in range(h+1):
    p[i] = [i, H[i]] i range(h+1) range h+1 h 1 p[i] = [i, H[i]] p[i] p i [i, H[i]] i H[i] H i for i in range(w+1):
    q[i] = [i, W[i]]
     i range(w+1) range w+1 w 1 q[i] = [i, W[i]] q[i] q i [i, W[i]] i W[i] W i p.sort(key= lambda val : val[1],reverse=True) p.sort p sort key= lambda val : val[1] key lambda val : val[1] val[1] val 1 val reverse=True reverse True q.sort(key= lambda val : val[1],reverse=True) q.sort q sort key= lambda val : val[1] key lambda val : val[1] val[1] val 1 val reverse=True reverse True mh = max(H) mh max(H) max H mw = max(W) mw max(W) max W I = H.count(mh) I H.count(mh) H.count H count mh J = W.count(mw) J W.count(mw) W.count W count mw sw = 0 sw 0 for i in range(I):
    if sw == 1:
        break
    for j in range(J):
        if (p[i][0], q[j][0]) in s:
            pass
        else:
            sw = 1
            break i range(I) range I if sw == 1:
        break
     sw == 1 sw 1 break for j in range(J):
        if (p[i][0], q[j][0]) in s:
            pass
        else:
            sw = 1
            break j range(J) range J if (p[i][0], q[j][0]) in s:
            pass
        else:
            sw = 1
            break (p[i][0], q[j][0]) in s (p[i][0], q[j][0]) p[i][0] [i] p i 0 q[j][0] [j] q j 0 s sw = 1 sw 1 break print(mh+mw-1+sw) print mh+mw-1+sw mh+mw-1 mh+mw mh mw 1 sw h,w,m = map(int,input().split()) map(int,input().split()) h I = H.count(mh) H.count(mh) I sw = 0 0 sw y = map(int,input().split()) map(int,input().split()) y p = [0]*(h+1) [0]*(h+1) p W = [0]*(w+1) [0]*(w+1) W sw = 1 1 sw J = W.count(mw) W.count(mw) J m = map(int,input().split()) map(int,input().split()) m mw = max(W) max(W) mw x,y = map(int,input().split()) map(int,input().split()) x mh = max(H) max(H) mh s = set([]) set([]) s q = [0]*(w+1) [0]*(w+1) q w,m = map(int,input().split()) map(int,input().split()) w H = [0]*(h+1) [0]*(h+1) H
h,w,m = map(int,input().split())
s = set([])
H = [0]*(h+1)
W = [0]*(w+1)
for i in range(m):
    x,y = map(int,input().split())
    H[x] += 1
    W[y] += 1
    s.add((x,y))
    
p = [0]*(h+1)
q = [0]*(w+1)
for i in range(h+1):
    p[i] = [i, H[i]]
for i in range(w+1):
    q[i] = [i, W[i]]
    
p.sort(key= lambda val : val[1],reverse=True)
q.sort(key= lambda val : val[1],reverse=True)

mh = max(H)
mw = max(W)
I = H.count(mh)
J = W.count(mw)

sw = 0
for i in range(I):
    if sw == 1:
        break
    for j in range(J):
        if (p[i][0], q[j][0]) in s:
            pass
        else:
            sw = 1
            break

print(mh+mw-1+sw)
