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

rows = [0] * H
cols = [0] * W
for h, w in hw:
    rows[h] += 1
    cols[w] += 1

max_rows = max(rows)
max_cols = max(cols)

max_rows_indexes = [i for i in range(H) if rows[i] == max_rows]
max_cols_indexes = [i for i in range(W) if cols[i] == max_cols]

duplicate = True
if M >= len(max_rows_indexes) * len(max_cols_indexes):
    for h in max_rows_indexes:
        for w in max_cols_indexes:
            if (h, w) not in hw:
                duplicate = False
                break
        if not duplicate:
            break
else:
    duplicate = False

if duplicate:
    print(max_rows + max_cols - 1)
else:
    print(max_rows + max_cols) 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 rows = [0] * H rows [0] * H [0] 0 H cols = [0] * W cols [0] * W [0] 0 W for h, w in hw:
    rows[h] += 1
    cols[w] += 1 h w hw rows[h] += 1 rows[h] rows h 1 cols[w] += 1 cols[w] cols w 1 max_rows = max(rows) max_rows max(rows) max rows max_cols = max(cols) max_cols max(cols) max cols i for i in range(H) if rows[i] == max_rows for i in range(H) if rows[i] == max_rows i range(H) range H rows[i] == max_rows rows[i] rows i max_rows if rows[i] == max_rows i max_rows_indexes = [i for i in range(H) if rows[i] == max_rows] max_rows_indexes [i for i in range(H) if rows[i] == max_rows] i for i in range(W) if cols[i] == max_cols for i in range(W) if cols[i] == max_cols i range(W) range W cols[i] == max_cols cols[i] cols i max_cols if cols[i] == max_cols i max_cols_indexes = [i for i in range(W) if cols[i] == max_cols] max_cols_indexes [i for i in range(W) if cols[i] == max_cols] duplicate = True duplicate True if M >= len(max_rows_indexes) * len(max_cols_indexes):
    for h in max_rows_indexes:
        for w in max_cols_indexes:
            if (h, w) not in hw:
                duplicate = False
                break
        if not duplicate:
            break
else:
    duplicate = False M >= len(max_rows_indexes) * len(max_cols_indexes) M len(max_rows_indexes) * len(max_cols_indexes) len(max_rows_indexes) len max_rows_indexes len(max_cols_indexes) len max_cols_indexes for h in max_rows_indexes:
        for w in max_cols_indexes:
            if (h, w) not in hw:
                duplicate = False
                break
        if not duplicate:
            break h max_rows_indexes for w in max_cols_indexes:
            if (h, w) not in hw:
                duplicate = False
                break
         w max_cols_indexes if (h, w) not in hw:
                duplicate = False
                break
         (h, w) not in hw (h, w) h w hw duplicate = False duplicate False break if not duplicate:
            break not duplicate duplicate break duplicate = False duplicate False if duplicate:
    print(max_rows + max_cols - 1)
else:
    print(max_rows + max_cols) duplicate print(max_rows + max_cols - 1) print max_rows + max_cols - 1 max_rows + max_cols max_rows max_cols 1 print(max_rows + max_cols) print max_rows + max_cols max_rows max_cols H, W, M = map(int, input().split()) map(int, input().split()) H duplicate = False False duplicate W, M = map(int, input().split()) map(int, input().split()) W M = map(int, input().split()) map(int, input().split()) M duplicate = True True duplicate 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 max_cols = max(cols) max(cols) max_cols max_rows_indexes = [i for i in range(H) if rows[i] == max_rows] [i for i in range(H) if rows[i] == max_rows] max_rows_indexes max_rows = max(rows) max(rows) max_rows duplicate = False False duplicate rows = [0] * H [0] * H rows cols = [0] * W [0] * W cols max_cols_indexes = [i for i in range(W) if cols[i] == max_cols] [i for i in range(W) if cols[i] == max_cols] max_cols_indexes
H, W, M = map(int, input().split())
hw = set(tuple(map(lambda x: int(x) - 1,input().split())) for _ in range(M))

rows = [0] * H
cols = [0] * W
for h, w in hw:
    rows[h] += 1
    cols[w] += 1

max_rows = max(rows)
max_cols = max(cols)

max_rows_indexes = [i for i in range(H) if rows[i] == max_rows]
max_cols_indexes = [i for i in range(W) if cols[i] == max_cols]

duplicate = True
if M >= len(max_rows_indexes) * len(max_cols_indexes):
    for h in max_rows_indexes:
        for w in max_cols_indexes:
            if (h, w) not in hw:
                duplicate = False
                break
        if not duplicate:
            break
else:
    duplicate = False

if duplicate:
    print(max_rows + max_cols - 1)
else:
    print(max_rows + max_cols)
