# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            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 h_sum = [0] * H h_sum [0] * H [0] 0 H w_sum = [0] * W w_sum [0] * W [0] 0 W point_list = set() point_list set() set for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1 _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w point_list.add((h-1, w-1)) point_list.add point_list add (h-1, w-1) h-1 h 1 w-1 w 1 h_sum[h-1] += 1 h_sum[h-1] h_sum h-1 h 1 1 w_sum[w-1] += 1 w_sum[w-1] w_sum w-1 w 1 1 h_max = max(h_sum) h_max max(h_sum) max h_sum w_max = max(w_sum) w_max max(w_sum) max w_sum h_argmax = set() h_argmax set() set w_argmax = set() w_argmax set() set for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i)  i h enumerate(h_sum) enumerate h_sum if h == h_max:
        h_argmax.add(i)  h == h_max h h_max h_argmax.add(i) h_argmax.add h_argmax add i for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i) i w enumerate(w_sum) enumerate w_sum if w == w_max:
        w_argmax.add(i) w == w_max w w_max w_argmax.add(i) w_argmax.add w_argmax add i ans = h_max + w_max ans h_max + w_max h_max w_max for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit() h h_argmax for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit() w w_argmax if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit() (h, w) not in point_list (h, w) h w point_list print(ans) print ans exit() exit print(ans - 1) print ans - 1 ans 1 w = map(int, input().split()) map(int, input().split()) w h_argmax = set() set() h_argmax h_max = max(h_sum) max(h_sum) h_max w_argmax = set() set() w_argmax w_max = max(w_sum) max(w_sum) w_max w_sum = [0] * W [0] * W w_sum ans = h_max + w_max h_max + w_max ans h, w = map(int, input().split()) map(int, input().split()) h H, W, M = map(int, input().split()) map(int, input().split()) H h_sum = [0] * H [0] * H h_sum M = map(int, input().split()) map(int, input().split()) M point_list = set() set() point_list W, M = map(int, input().split()) map(int, input().split()) W
# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)
