H, W, M = map(int, input().split())
HW = set(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M))

sum_h = [0]*H; sum_w = [0]*W
for h, w in HW:
    sum_h[h] += 1
    sum_w[w] += 1

max_h_num = 0
h_num_ix = {}
for i in range(H):
    num = sum_h[i]
    if num == 0: continue
    if not num in h_num_ix: h_num_ix[num] = set()
    h_num_ix[num].add(i)
    max_h_num = max(max_h_num, num)

max_w_num = 0
w_num_ix = {}
for i in range(W):
    num = sum_w[i]
    if num == 0: continue
    if not num in w_num_ix: w_num_ix[num] = set()
    w_num_ix[num].add(i)
    max_w_num = max(max_w_num, num)

max_num = max_h_num + max_w_num - 1
for h_ix in h_num_ix[max_h_num]:
    for w_ix in w_num_ix[max_w_num]:
        if (h_ix, w_ix) in HW: continue
        print(max_num + 1)
        exit()
print(max_num) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M HW = set(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M)) HW set(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M)) set tuple(map(lambda x: int(x)-1, input().split())) tuple 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 sum_h = [0]*H sum_h [0]*H [0] 0 H sum_w = [0]*W sum_w [0]*W [0] 0 W for h, w in HW:
    sum_h[h] += 1
    sum_w[w] += 1 h w HW sum_h[h] += 1 sum_h[h] sum_h h 1 sum_w[w] += 1 sum_w[w] sum_w w 1 max_h_num = 0 max_h_num 0 h_num_ix = {} h_num_ix {} for i in range(H):
    num = sum_h[i]
    if num == 0: continue
    if not num in h_num_ix: h_num_ix[num] = set()
    h_num_ix[num].add(i)
    max_h_num = max(max_h_num, num) i range(H) range H num = sum_h[i] num sum_h[i] sum_h i if num == 0: continue
     num == 0 num 0 if not num in h_num_ix: h_num_ix[num] = set()
     not num in h_num_ix num in h_num_ix num h_num_ix h_num_ix[num].add(i) [num].add [num] h_num_ix num add i max_h_num = max(max_h_num, num) max_h_num max(max_h_num, num) max max_h_num num max_w_num = 0 max_w_num 0 w_num_ix = {} w_num_ix {} for i in range(W):
    num = sum_w[i]
    if num == 0: continue
    if not num in w_num_ix: w_num_ix[num] = set()
    w_num_ix[num].add(i)
    max_w_num = max(max_w_num, num) i range(W) range W num = sum_w[i] num sum_w[i] sum_w i if num == 0: continue
     num == 0 num 0 if not num in w_num_ix: w_num_ix[num] = set()
     not num in w_num_ix num in w_num_ix num w_num_ix w_num_ix[num].add(i) [num].add [num] w_num_ix num add i max_w_num = max(max_w_num, num) max_w_num max(max_w_num, num) max max_w_num num max_num = max_h_num + max_w_num - 1 max_num max_h_num + max_w_num - 1 max_h_num + max_w_num max_h_num max_w_num 1 for h_ix in h_num_ix[max_h_num]:
    for w_ix in w_num_ix[max_w_num]:
        if (h_ix, w_ix) in HW: continue
        print(max_num + 1)
        exit() h_ix h_num_ix[max_h_num] h_num_ix max_h_num for w_ix in w_num_ix[max_w_num]:
        if (h_ix, w_ix) in HW: continue
        print(max_num + 1)
        exit() w_ix w_num_ix[max_w_num] w_num_ix max_w_num if (h_ix, w_ix) in HW: continue
         (h_ix, w_ix) in HW (h_ix, w_ix) h_ix w_ix HW print(max_num + 1) print max_num + 1 max_num 1 exit() exit print(max_num) print max_num max_w_num = max(max_w_num, num) max(max_w_num, num) max_w_num max_h_num = max(max_h_num, num) max(max_h_num, num) max_h_num H, W, M = map(int, input().split()) map(int, input().split()) H max_h_num = 0 0 max_h_num max_num = max_h_num + max_w_num - 1 max_h_num + max_w_num - 1 max_num HW = set(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M)) set(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M)) HW h_num_ix = {} {} h_num_ix w_num_ix = {} {} w_num_ix W, M = map(int, input().split()) map(int, input().split()) W sum_h = [0]*H [0]*H sum_h sum_w = [0]*W [0]*W sum_w M = map(int, input().split()) map(int, input().split()) M num = sum_h[i] sum_h[i] num num = sum_w[i] sum_w[i] num max_w_num = 0 0 max_w_num
H, W, M = map(int, input().split())
HW = set(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M))

sum_h = [0]*H; sum_w = [0]*W
for h, w in HW:
    sum_h[h] += 1
    sum_w[w] += 1

max_h_num = 0
h_num_ix = {}
for i in range(H):
    num = sum_h[i]
    if num == 0: continue
    if not num in h_num_ix: h_num_ix[num] = set()
    h_num_ix[num].add(i)
    max_h_num = max(max_h_num, num)

max_w_num = 0
w_num_ix = {}
for i in range(W):
    num = sum_w[i]
    if num == 0: continue
    if not num in w_num_ix: w_num_ix[num] = set()
    w_num_ix[num].add(i)
    max_w_num = max(max_w_num, num)

max_num = max_h_num + max_w_num - 1
for h_ix in h_num_ix[max_h_num]:
    for w_ix in w_num_ix[max_w_num]:
        if (h_ix, w_ix) in HW: continue
        print(max_num + 1)
        exit()
print(max_num)
