H, W, M = map(int, input().split())
bombs = {}
rows = []
cols = []
for i in range(H):
    rows.append([i, 0])
for i in range(W):
    cols.append([i, 0])
for i in range(M):
    y, x = map(lambda x: x - 1, map(int, input().split()))
    bombs[(y,x)] = True
    rows[y][1] += 1
    cols[x][1] += 1


rows = sorted(rows, key=lambda x: x[1], reverse=True)
cols = sorted(cols, key=lambda x: x[1], reverse=True)
answer = 0
for row in rows:
    a = cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0)
    if a > answer:
        answer = a
for col in cols:
    a = rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0)
    if a > answer:
        answer = a
print(answer) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M bombs = {} bombs {} rows = [] rows [] cols = [] cols [] for i in range(H):
    rows.append([i, 0]) i range(H) range H rows.append([i, 0]) rows.append rows append [i, 0] i 0 for i in range(W):
    cols.append([i, 0]) i range(W) range W cols.append([i, 0]) cols.append cols append [i, 0] i 0 for i in range(M):
    y, x = map(lambda x: x - 1, map(int, input().split()))
    bombs[(y,x)] = True
    rows[y][1] += 1
    cols[x][1] += 1 i range(M) range M y, x = map(lambda x: x - 1, map(int, input().split())) y map(lambda x: x - 1, map(int, input().split())) map lambda x: x - 1 x - 1 x 1 x map(int, input().split()) map int input().split() ().split () input split x bombs[(y,x)] = True bombs[(y,x)] bombs (y,x) y x True rows[y][1] += 1 rows[y][1] [y] rows y 1 1 cols[x][1] += 1 cols[x][1] [x] cols x 1 1 rows = sorted(rows, key=lambda x: x[1], reverse=True) rows sorted(rows, key=lambda x: x[1], reverse=True) sorted rows key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x reverse=True reverse True cols = sorted(cols, key=lambda x: x[1], reverse=True) cols sorted(cols, key=lambda x: x[1], reverse=True) sorted cols key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x reverse=True reverse True answer = 0 answer 0 for row in rows:
    a = cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0)
    if a > answer:
        answer = a row rows a = cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0) a cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0) cols[0][1] + row[1] cols[0][1] [0] cols 0 1 row[1] row 1 1 if (row[0], cols[0][0]) in bombs else 0 (row[0], cols[0][0]) in bombs (row[0], cols[0][0]) row[0] row 0 cols[0][0] [0] cols 0 0 bombs 1 0 if a > answer:
        answer = a a > answer a answer answer = a answer a for col in cols:
    a = rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0)
    if a > answer:
        answer = a col cols a = rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0) a rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0) rows[0][1] + col[1] rows[0][1] [0] rows 0 1 col[1] col 1 1 if (rows[0][0], col[0]) in bombs else 0 (rows[0][0], col[0]) in bombs (rows[0][0], col[0]) rows[0][0] [0] rows 0 0 col[0] col 0 bombs 1 0 if a > answer:
        answer = a a > answer a answer answer = a answer a print(answer) print answer cols = sorted(cols, key=lambda x: x[1], reverse=True) sorted(cols, key=lambda x: x[1], reverse=True) cols answer = 0 0 answer cols = [] [] cols M = map(int, input().split()) map(int, input().split()) M x = map(lambda x: x - 1, map(int, input().split())) map(lambda x: x - 1, map(int, input().split())) x answer = a a answer H, W, M = map(int, input().split()) map(int, input().split()) H bombs = {} {} bombs answer = a a answer rows = sorted(rows, key=lambda x: x[1], reverse=True) sorted(rows, key=lambda x: x[1], reverse=True) rows a = cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0) cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0) a W, M = map(int, input().split()) map(int, input().split()) W rows = [] [] rows y, x = map(lambda x: x - 1, map(int, input().split())) map(lambda x: x - 1, map(int, input().split())) y a = rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0) rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0) a
H, W, M = map(int, input().split())
bombs = {}
rows = []
cols = []
for i in range(H):
    rows.append([i, 0])
for i in range(W):
    cols.append([i, 0])
for i in range(M):
    y, x = map(lambda x: x - 1, map(int, input().split()))
    bombs[(y,x)] = True
    rows[y][1] += 1
    cols[x][1] += 1


rows = sorted(rows, key=lambda x: x[1], reverse=True)
cols = sorted(cols, key=lambda x: x[1], reverse=True)
answer = 0
for row in rows:
    a = cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0)
    if a > answer:
        answer = a
for col in cols:
    a = rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0)
    if a > answer:
        answer = a
print(answer)