#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


H, W, M = MI()

R = np.zeros(H + 1)
C = np.zeros(W + 1)
bombs = []
for _ in range(M):
    h, w = MI()
    bombs.append((h, w))
    R[h] += 1
    C[w] += 1

R_max = [R == max(R)]
ans = max(R) + max(C)
C_max = [C == max(C)]

cnt = 0
for h, w in bombs:
    if R_max[0][h] and C_max[0][w]:
        cnt += 1

if cnt == np.count_nonzero(R_max) * np.count_nonzero(C_max):
    print(int(ans - 1))
else:
    print(int(ans)) import sys sys import numpy as np numpy input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def S():
    return input().rstrip() S return input().rstrip() input().rstrip() ().rstrip () input rstrip def I():
    return int(input()) I return int(input()) int(input()) int input() input def MI():
    return map(int, input().split()) MI return map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split H, W, M = MI() H MI() MI W M R = np.zeros(H + 1) R np.zeros(H + 1) np.zeros np zeros H + 1 H 1 C = np.zeros(W + 1) C np.zeros(W + 1) np.zeros np zeros W + 1 W 1 bombs = [] bombs [] for _ in range(M):
    h, w = MI()
    bombs.append((h, w))
    R[h] += 1
    C[w] += 1 _ range(M) range M h, w = MI() h MI() MI w bombs.append((h, w)) bombs.append bombs append (h, w) h w R[h] += 1 R[h] R h 1 C[w] += 1 C[w] C w 1 R_max = [R == max(R)] R_max [R == max(R)] R == max(R) R max(R) max R ans = max(R) + max(C) ans max(R) + max(C) max(R) max R max(C) max C C_max = [C == max(C)] C_max [C == max(C)] C == max(C) C max(C) max C cnt = 0 cnt 0 for h, w in bombs:
    if R_max[0][h] and C_max[0][w]:
        cnt += 1 h w bombs if R_max[0][h] and C_max[0][w]:
        cnt += 1 R_max[0][h] and C_max[0][w] R_max[0][h] [0] R_max 0 h C_max[0][w] [0] C_max 0 w cnt += 1 cnt 1 if cnt == np.count_nonzero(R_max) * np.count_nonzero(C_max):
    print(int(ans - 1))
else:
    print(int(ans)) cnt == np.count_nonzero(R_max) * np.count_nonzero(C_max) cnt np.count_nonzero(R_max) * np.count_nonzero(C_max) np.count_nonzero(R_max) np.count_nonzero np count_nonzero R_max np.count_nonzero(C_max) np.count_nonzero np count_nonzero C_max print(int(ans - 1)) print int(ans - 1) int ans - 1 ans 1 print(int(ans)) print int(ans) int ans C = np.zeros(W + 1) np.zeros(W + 1) C R = np.zeros(H + 1) np.zeros(H + 1) R input = sys.stdin.readline sys.stdin.readline input cnt += 1 1 cnt def I():
    return int(input()) def I():
    return int(input()) I def MI():
    return map(int, input().split()) def MI():
    return map(int, input().split()) MI def S():
    return input().rstrip() def S():
    return input().rstrip() S H, W, M = MI() MI() H w = MI() MI() w bombs = [] [] bombs R_max = [R == max(R)] [R == max(R)] R_max M = MI() MI() M ans = max(R) + max(C) max(R) + max(C) ans h, w = MI() MI() h W, M = MI() MI() W C_max = [C == max(C)] [C == max(C)] C_max cnt = 0 0 cnt
#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


H, W, M = MI()

R = np.zeros(H + 1)
C = np.zeros(W + 1)
bombs = []
for _ in range(M):
    h, w = MI()
    bombs.append((h, w))
    R[h] += 1
    C[w] += 1

R_max = [R == max(R)]
ans = max(R) + max(C)
C_max = [C == max(C)]

cnt = 0
for h, w in bombs:
    if R_max[0][h] and C_max[0][w]:
        cnt += 1

if cnt == np.count_nonzero(R_max) * np.count_nonzero(C_max):
    print(int(ans - 1))
else:
    print(int(ans))
