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

H_count = [0 for i in range(H)]
W_count = [0 for i in range(W)]

for i in range(M):
    h, w = map(lambda x:int(x) - 1, input().split())
    bombs.add((h, w))
    H_count[h] += 1
    W_count[w] += 1


A = max(H_count)
B = max(W_count)
Ah = []
Bw = []

for i, count in enumerate(H_count):
    if count == A:
        Ah.append(i)

for i, count in enumerate(W_count):
    if count == B:
        Bw.append(i)

ans = A + B
for h in Ah:
    for w in Bw:
        if (h, w) not in bombs:
            print(ans)
            exit()

print(ans - 1) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M bombs = set() bombs set() set 0 for i in range(H) for i in range(H) i range(H) range H for i in range(H) 0 H_count = [0 for i in range(H)] H_count [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_count = [0 for i in range(W)] W_count [0 for i in range(W)] for i in range(M):
    h, w = map(lambda x:int(x) - 1, input().split())
    bombs.add((h, w))
    H_count[h] += 1
    W_count[w] += 1 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 bombs.add((h, w)) bombs.add bombs add (h, w) h w H_count[h] += 1 H_count[h] H_count h 1 W_count[w] += 1 W_count[w] W_count w 1 A = max(H_count) A max(H_count) max H_count B = max(W_count) B max(W_count) max W_count Ah = [] Ah [] Bw = [] Bw [] for i, count in enumerate(H_count):
    if count == A:
        Ah.append(i) i count enumerate(H_count) enumerate H_count if count == A:
        Ah.append(i) count == A count A Ah.append(i) Ah.append Ah append i for i, count in enumerate(W_count):
    if count == B:
        Bw.append(i) i count enumerate(W_count) enumerate W_count if count == B:
        Bw.append(i) count == B count B Bw.append(i) Bw.append Bw append i ans = A + B ans A + B A B for h in Ah:
    for w in Bw:
        if (h, w) not in bombs:
            print(ans)
            exit() h Ah for w in Bw:
        if (h, w) not in bombs:
            print(ans)
            exit() w Bw if (h, w) not in bombs:
            print(ans)
            exit() (h, w) not in bombs (h, w) h w bombs print(ans) print ans exit() exit print(ans - 1) print ans - 1 ans 1 A = max(H_count) max(H_count) A h, w = map(lambda x:int(x) - 1, input().split()) map(lambda x:int(x) - 1, input().split()) h ans = A + B A + B ans B = max(W_count) max(W_count) B w = map(lambda x:int(x) - 1, input().split()) map(lambda x:int(x) - 1, input().split()) w H_count = [0 for i in range(H)] [0 for i in range(H)] H_count Bw = [] [] Bw W, M = map(int, input().split()) map(int, input().split()) W M = map(int, input().split()) map(int, input().split()) M Ah = [] [] Ah H, W, M = map(int, input().split()) map(int, input().split()) H W_count = [0 for i in range(W)] [0 for i in range(W)] W_count bombs = set() set() bombs
H, W, M = map(int, input().split())
bombs = set()

H_count = [0 for i in range(H)]
W_count = [0 for i in range(W)]

for i in range(M):
    h, w = map(lambda x:int(x) - 1, input().split())
    bombs.add((h, w))
    H_count[h] += 1
    W_count[w] += 1


A = max(H_count)
B = max(W_count)
Ah = []
Bw = []

for i, count in enumerate(H_count):
    if count == A:
        Ah.append(i)

for i, count in enumerate(W_count):
    if count == B:
        Bw.append(i)

ans = A + B
for h in Ah:
    for w in Bw:
        if (h, w) not in bombs:
            print(ans)
            exit()

print(ans - 1)
