H,W,M=map(int,input().split())
row=[0]*H
col=[0]*W
target=set()
for i in range(M):
    h,w=map(int,input().split())
    row[h-1]+=1
    col[w-1]+=1
    target.add((h-1,w-1))
A=max(row)
B=max(col)
a=[x for x in range(H) if row[x]==A]
b=[x for x in range(W) if col[x]==B]
cnt=0
for i in a:
    for j in b:
        cnt+=1
        if (i,j) not in target:
            print(A+B)
            exit(0)
        if cnt>M:
            print(A+B-1)
            exit(0)
print(A+B-1) 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 target=set() target set() set for i in range(M):
    h,w=map(int,input().split())
    row[h-1]+=1
    col[w-1]+=1
    target.add((h-1,w-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 row[h-1]+=1 row[h-1] row h-1 h 1 1 col[w-1]+=1 col[w-1] col w-1 w 1 1 target.add((h-1,w-1)) target.add target add (h-1,w-1) h-1 h 1 w-1 w 1 A=max(row) A max(row) max row B=max(col) B max(col) max col x for x in range(H) if row[x]==A for x in range(H) if row[x]==A x range(H) range H row[x]==A row[x] row x A if row[x]==A x a=[x for x in range(H) if row[x]==A] a [x for x in range(H) if row[x]==A] x for x in range(W) if col[x]==B for x in range(W) if col[x]==B x range(W) range W col[x]==B col[x] col x B if col[x]==B x b=[x for x in range(W) if col[x]==B] b [x for x in range(W) if col[x]==B] cnt=0 cnt 0 for i in a:
    for j in b:
        cnt+=1
        if (i,j) not in target:
            print(A+B)
            exit(0)
        if cnt>M:
            print(A+B-1)
            exit(0) i a for j in b:
        cnt+=1
        if (i,j) not in target:
            print(A+B)
            exit(0)
        if cnt>M:
            print(A+B-1)
            exit(0) j b cnt+=1 cnt 1 if (i,j) not in target:
            print(A+B)
            exit(0)
         (i,j) not in target (i,j) i j target print(A+B) print A+B A B exit(0) exit 0 if cnt>M:
            print(A+B-1)
            exit(0) cnt>M cnt M print(A+B-1) print A+B-1 A+B A B 1 exit(0) exit 0 print(A+B-1) print A+B-1 A+B A B 1 col=[0]*W [0]*W col B=max(col) max(col) B H,W,M=map(int,input().split()) map(int,input().split()) H W,M=map(int,input().split()) map(int,input().split()) W M=map(int,input().split()) map(int,input().split()) M w=map(int,input().split()) map(int,input().split()) w cnt=0 0 cnt A=max(row) max(row) A cnt+=1 1 cnt h,w=map(int,input().split()) map(int,input().split()) h b=[x for x in range(W) if col[x]==B] [x for x in range(W) if col[x]==B] b target=set() set() target row=[0]*H [0]*H row a=[x for x in range(H) if row[x]==A] [x for x in range(H) if row[x]==A] a
H,W,M=map(int,input().split())
row=[0]*H
col=[0]*W
target=set()
for i in range(M):
    h,w=map(int,input().split())
    row[h-1]+=1
    col[w-1]+=1
    target.add((h-1,w-1))
A=max(row)
B=max(col)
a=[x for x in range(H) if row[x]==A]
b=[x for x in range(W) if col[x]==B]
cnt=0
for i in a:
    for j in b:
        cnt+=1
        if (i,j) not in target:
            print(A+B)
            exit(0)
        if cnt>M:
            print(A+B-1)
            exit(0)
print(A+B-1)