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