import collections
H, W, M = map(int, input().split())

h, w = [0]*M, [0]*M
dic = set()
for i in range(M):
    h[i], w[i] = map(int, input().split())
    dic.add((h[i],w[i]))

counter = collections.Counter(h)
h_max = max(counter.values())
mode_h = [key for key , value in counter.items() if value == h_max]
counter = collections.Counter(w)
w_max = max(counter.values())
mode_w = [key for key , value in counter.items() if value == w_max]

for i in mode_h:
    for j in mode_w:
        if (i,j) not in dic:
            print(h_max+w_max)
            exit()

print(h_max+w_max-1)
 import collections collections H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M h, w = [0]*M, [0]*M h [0]*M [0] 0 M w [0]*M [0] 0 M dic = set() dic set() set for i in range(M):
    h[i], w[i] = map(int, input().split())
    dic.add((h[i],w[i])) i range(M) range M h[i], w[i] = map(int, input().split()) h[i] h i map(int, input().split()) map int input().split() ().split () input split w[i] w i dic.add((h[i],w[i])) dic.add dic add (h[i],w[i]) h[i] h i w[i] w i counter = collections.Counter(h) counter collections.Counter(h) collections.Counter collections Counter h h_max = max(counter.values()) h_max max(counter.values()) max counter.values() counter.values counter values key for key , value in counter.items() if value == h_max for key , value in counter.items() if value == h_max key value counter.items() counter.items counter items value == h_max value h_max if value == h_max key mode_h = [key for key , value in counter.items() if value == h_max] mode_h [key for key , value in counter.items() if value == h_max] counter = collections.Counter(w) counter collections.Counter(w) collections.Counter collections Counter w w_max = max(counter.values()) w_max max(counter.values()) max counter.values() counter.values counter values key for key , value in counter.items() if value == w_max for key , value in counter.items() if value == w_max key value counter.items() counter.items counter items value == w_max value w_max if value == w_max key mode_w = [key for key , value in counter.items() if value == w_max] mode_w [key for key , value in counter.items() if value == w_max] for i in mode_h:
    for j in mode_w:
        if (i,j) not in dic:
            print(h_max+w_max)
            exit() i mode_h for j in mode_w:
        if (i,j) not in dic:
            print(h_max+w_max)
            exit() j mode_w if (i,j) not in dic:
            print(h_max+w_max)
            exit() (i,j) not in dic (i,j) i j dic print(h_max+w_max) print h_max+w_max h_max w_max exit() exit print(h_max+w_max-1) print h_max+w_max-1 h_max+w_max h_max w_max 1 H, W, M = map(int, input().split()) map(int, input().split()) H mode_h = [key for key , value in counter.items() if value == h_max] [key for key , value in counter.items() if value == h_max] mode_h w_max = max(counter.values()) max(counter.values()) w_max dic = set() set() dic w = [0]*M, [0]*M [0]*M w h, w = [0]*M, [0]*M [0]*M h counter = collections.Counter(h) collections.Counter(h) counter M = map(int, input().split()) map(int, input().split()) M h_max = max(counter.values()) max(counter.values()) h_max counter = collections.Counter(w) collections.Counter(w) counter mode_w = [key for key , value in counter.items() if value == w_max] [key for key , value in counter.items() if value == w_max] mode_w W, M = map(int, input().split()) map(int, input().split()) W
import collections
H, W, M = map(int, input().split())

h, w = [0]*M, [0]*M
dic = set()
for i in range(M):
    h[i], w[i] = map(int, input().split())
    dic.add((h[i],w[i]))

counter = collections.Counter(h)
h_max = max(counter.values())
mode_h = [key for key , value in counter.items() if value == h_max]
counter = collections.Counter(w)
w_max = max(counter.values())
mode_w = [key for key , value in counter.items() if value == w_max]

for i in mode_h:
    for j in mode_w:
        if (i,j) not in dic:
            print(h_max+w_max)
            exit()

print(h_max+w_max-1)

