h, w, m = map(int, input().split())
a_list = []
b_list = []
h_list = [0 for _ in range(h)]
w_list = [0 for _ in range(w)]
for i in range(m):
    a, b = map(int, input().split())
    a_list.append([a,b])
    h_list[a - 1] += 1
    w_list[b - 1] += 1
h_max = max(h_list)
w_max = max(w_list)
w_flag = [0 for _ in range(w)]
for i in range(w):
    if w_list[i] == w_max:
        w_flag[i] = 1
h_flag = [0 for _ in range(h)]
for i in range(h):
    if h_list[i] == h_max:
        h_flag[i] = 1
flag = 0   
for i in range(m):
    if h_flag[a_list[i][0] - 1] == 1 and w_flag[a_list[i][1] - 1] == 1:
        flag += 1
s = sum(h_flag) * sum(w_flag)
print(h_max + w_max - 1 if flag == s else h_max + w_max)         h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m a_list = [] a_list [] b_list = [] b_list [] 0 for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) 0 h_list = [0 for _ in range(h)] h_list [0 for _ in range(h)] 0 for _ in range(w) for _ in range(w) _ range(w) range w for _ in range(w) 0 w_list = [0 for _ in range(w)] w_list [0 for _ in range(w)] for i in range(m):
    a, b = map(int, input().split())
    a_list.append([a,b])
    h_list[a - 1] += 1
    w_list[b - 1] += 1 i range(m) range m a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b a_list.append([a,b]) a_list.append a_list append [a,b] a b h_list[a - 1] += 1 h_list[a - 1] h_list a - 1 a 1 1 w_list[b - 1] += 1 w_list[b - 1] w_list b - 1 b 1 1 h_max = max(h_list) h_max max(h_list) max h_list w_max = max(w_list) w_max max(w_list) max w_list 0 for _ in range(w) for _ in range(w) _ range(w) range w for _ in range(w) 0 w_flag = [0 for _ in range(w)] w_flag [0 for _ in range(w)] for i in range(w):
    if w_list[i] == w_max:
        w_flag[i] = 1 i range(w) range w if w_list[i] == w_max:
        w_flag[i] = 1 w_list[i] == w_max w_list[i] w_list i w_max w_flag[i] = 1 w_flag[i] w_flag i 1 0 for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) 0 h_flag = [0 for _ in range(h)] h_flag [0 for _ in range(h)] for i in range(h):
    if h_list[i] == h_max:
        h_flag[i] = 1 i range(h) range h if h_list[i] == h_max:
        h_flag[i] = 1 h_list[i] == h_max h_list[i] h_list i h_max h_flag[i] = 1 h_flag[i] h_flag i 1 flag = 0 flag 0 for i in range(m):
    if h_flag[a_list[i][0] - 1] == 1 and w_flag[a_list[i][1] - 1] == 1:
        flag += 1 i range(m) range m if h_flag[a_list[i][0] - 1] == 1 and w_flag[a_list[i][1] - 1] == 1:
        flag += 1 h_flag[a_list[i][0] - 1] == 1 and w_flag[a_list[i][1] - 1] == 1 h_flag[a_list[i][0] - 1] == 1 h_flag[a_list[i][0] - 1] h_flag a_list[i][0] - 1 a_list[i][0] [i] a_list i 0 1 1 w_flag[a_list[i][1] - 1] == 1 w_flag[a_list[i][1] - 1] w_flag a_list[i][1] - 1 a_list[i][1] [i] a_list i 1 1 1 flag += 1 flag 1 s = sum(h_flag) * sum(w_flag) s sum(h_flag) * sum(w_flag) sum(h_flag) sum h_flag sum(w_flag) sum w_flag print(h_max + w_max - 1 if flag == s else h_max + w_max) print h_max + w_max - 1 if flag == s else h_max + w_max flag == s flag s h_max + w_max - 1 h_max + w_max h_max w_max 1 h_max + w_max h_max w_max w, m = map(int, input().split()) map(int, input().split()) w m = map(int, input().split()) map(int, input().split()) m b_list = [] [] b_list h_flag = [0 for _ in range(h)] [0 for _ in range(h)] h_flag s = sum(h_flag) * sum(w_flag) sum(h_flag) * sum(w_flag) s flag += 1 1 flag w_max = max(w_list) max(w_list) w_max a_list = [] [] a_list w_flag = [0 for _ in range(w)] [0 for _ in range(w)] w_flag w_list = [0 for _ in range(w)] [0 for _ in range(w)] w_list h_list = [0 for _ in range(h)] [0 for _ in range(h)] h_list b = map(int, input().split()) map(int, input().split()) b h_max = max(h_list) max(h_list) h_max flag = 0 0 flag h, w, m = map(int, input().split()) map(int, input().split()) h a, b = map(int, input().split()) map(int, input().split()) a
h, w, m = map(int, input().split())
a_list = []
b_list = []
h_list = [0 for _ in range(h)]
w_list = [0 for _ in range(w)]
for i in range(m):
    a, b = map(int, input().split())
    a_list.append([a,b])
    h_list[a - 1] += 1
    w_list[b - 1] += 1
h_max = max(h_list)
w_max = max(w_list)
w_flag = [0 for _ in range(w)]
for i in range(w):
    if w_list[i] == w_max:
        w_flag[i] = 1
h_flag = [0 for _ in range(h)]
for i in range(h):
    if h_list[i] == h_max:
        h_flag[i] = 1
flag = 0   
for i in range(m):
    if h_flag[a_list[i][0] - 1] == 1 and w_flag[a_list[i][1] - 1] == 1:
        flag += 1
s = sum(h_flag) * sum(w_flag)
print(h_max + w_max - 1 if flag == s else h_max + w_max)        
