h, w, m = map(int, input().split())
bord_x, bord_y = [0]*h, [0]*w
 
hw = []
for _i in range(m):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    bord_x[s] += 1
    bord_y[t] += 1
    hw.append([s, t])
 
x_max, y_max = max(bord_x), max(bord_y)
 
cnt = 0
for i, j in hw:
    if bord_x[i] == x_max and bord_y[j] == y_max:
        cnt += 1
 
if cnt == bord_x.count(x_max)*bord_y.count(y_max):
    x_max -= 1
 
print(x_max+y_max) h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m bord_x, bord_y = [0]*h, [0]*w bord_x [0]*h [0] 0 h bord_y [0]*w [0] 0 w hw = [] hw [] for _i in range(m):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    bord_x[s] += 1
    bord_y[t] += 1
    hw.append([s, t])
  _i range(m) range m s, t = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split t s -= 1 s 1 t -= 1 t 1 bord_x[s] += 1 bord_x[s] bord_x s 1 bord_y[t] += 1 bord_y[t] bord_y t 1 hw.append([s, t]) hw.append hw append [s, t] s t x_max, y_max = max(bord_x), max(bord_y) x_max max(bord_x) max bord_x y_max max(bord_y) max bord_y cnt = 0 cnt 0 for i, j in hw:
    if bord_x[i] == x_max and bord_y[j] == y_max:
        cnt += 1
  i j hw if bord_x[i] == x_max and bord_y[j] == y_max:
        cnt += 1
  bord_x[i] == x_max and bord_y[j] == y_max bord_x[i] == x_max bord_x[i] bord_x i x_max bord_y[j] == y_max bord_y[j] bord_y j y_max cnt += 1 cnt 1 if cnt == bord_x.count(x_max)*bord_y.count(y_max):
    x_max -= 1
  cnt == bord_x.count(x_max)*bord_y.count(y_max) cnt bord_x.count(x_max)*bord_y.count(y_max) bord_x.count(x_max) bord_x.count bord_x count x_max bord_y.count(y_max) bord_y.count bord_y count y_max x_max -= 1 x_max 1 print(x_max+y_max) print x_max+y_max x_max y_max cnt = 0 0 cnt bord_x, bord_y = [0]*h, [0]*w [0]*h bord_x m = map(int, input().split()) map(int, input().split()) m h, w, m = map(int, input().split()) map(int, input().split()) h cnt += 1 1 cnt y_max = max(bord_x), max(bord_y) max(bord_y) y_max bord_y = [0]*h, [0]*w [0]*w bord_y t -= 1 1 t w, m = map(int, input().split()) map(int, input().split()) w x_max -= 1 1 x_max t = map(int, input().split()) map(int, input().split()) t hw = [] [] hw s, t = map(int, input().split()) map(int, input().split()) s s -= 1 1 s x_max, y_max = max(bord_x), max(bord_y) max(bord_x) x_max
h, w, m = map(int, input().split())
bord_x, bord_y = [0]*h, [0]*w
 
hw = []
for _i in range(m):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    bord_x[s] += 1
    bord_y[t] += 1
    hw.append([s, t])
 
x_max, y_max = max(bord_x), max(bord_y)
 
cnt = 0
for i, j in hw:
    if bord_x[i] == x_max and bord_y[j] == y_max:
        cnt += 1
 
if cnt == bord_x.count(x_max)*bord_y.count(y_max):
    x_max -= 1
 
print(x_max+y_max)