import numpy as np
import numba
import sys
from numba import njit, b1, i4, i8, f8

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


@njit((i8, i8, i8[:]), cache=True)
def main(Height, Width, XY):
    UP = 300010
    row = np.zeros(UP, np.int64)
    col = np.zeros(UP, np.int64)
    
    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        row[x] += 1
        col[y] += 1
    
    row_max = row.max()
    col_max = col.max()

    judge = np.sum(row == row_max) * np.sum(col == col_max)

    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        
        if (row[x] == row_max and col[y] == col_max):
            judge -= 1
    
    summ = row_max + col_max
    
    return (summ if judge else summ - 1)


Height, Width, M_ko = map(int, readline().split())
XY = np.array(read().split(), np.int64)

ans = main(Height, Width, XY)
print(ans) import numpy as np numpy import numba numba import sys sys from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines def main(Height, Width, XY):
    UP = 300010
    row = np.zeros(UP, np.int64)
    col = np.zeros(UP, np.int64)
    
    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        row[x] += 1
        col[y] += 1
    
    row_max = row.max()
    col_max = col.max()

    judge = np.sum(row == row_max) * np.sum(col == col_max)

    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        
        if (row[x] == row_max and col[y] == col_max):
            judge -= 1
    
    summ = row_max + col_max
    
    return (summ if judge else summ - 1) main UP = 300010 UP 300010 row = np.zeros(UP, np.int64) row np.zeros(UP, np.int64) np.zeros np zeros UP np.int64 np int64 col = np.zeros(UP, np.int64) col np.zeros(UP, np.int64) np.zeros np zeros UP np.int64 np int64 for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        row[x] += 1
        col[y] += 1
    
     i range(0, len(XY), 2) range 0 len(XY) len XY 2 x, y = XY[i:i + 2] - 1 x XY[i:i + 2] - 1 XY[i:i + 2] XY i:i + 2 i i + 2 i 2 1 y row[x] += 1 row[x] row x 1 col[y] += 1 col[y] col y 1 row_max = row.max() row_max row.max() row.max row max col_max = col.max() col_max col.max() col.max col max judge = np.sum(row == row_max) * np.sum(col == col_max) judge np.sum(row == row_max) * np.sum(col == col_max) np.sum(row == row_max) np.sum np sum row == row_max row row_max np.sum(col == col_max) np.sum np sum col == col_max col col_max for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        
        if (row[x] == row_max and col[y] == col_max):
            judge -= 1
    
     i range(0, len(XY), 2) range 0 len(XY) len XY 2 x, y = XY[i:i + 2] - 1 x XY[i:i + 2] - 1 XY[i:i + 2] XY i:i + 2 i i + 2 i 2 1 y if (row[x] == row_max and col[y] == col_max):
            judge -= 1
    
     row[x] == row_max and col[y] == col_max row[x] == row_max row[x] row x row_max col[y] == col_max col[y] col y col_max judge -= 1 judge 1 summ = row_max + col_max summ row_max + col_max row_max col_max return (summ if judge else summ - 1) summ if judge else summ - 1 judge summ summ - 1 summ 1 Height Height Width Width XY XY @njit((i8, i8, i8[:]), cache=True) main (i8, i8, i8[:]), cache=True @njit((i8, i8, i8[:]), cache=True) njit (i8, i8, i8[:]) i8 i8 i8[:] i8 : cache=True cache True main Height, Width, M_ko = map(int, readline().split()) Height map(int, readline().split()) map int readline().split() ().split () readline split Width M_ko XY = np.array(read().split(), np.int64) XY np.array(read().split(), np.int64) np.array np array read().split() ().split () read split np.int64 np int64 ans = main(Height, Width, XY) ans main(Height, Width, XY) main Height Width XY print(ans) print ans XY = np.array(read().split(), np.int64) np.array(read().split(), np.int64) XY Width, M_ko = map(int, readline().split()) map(int, readline().split()) Width readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline read = sys.stdin.buffer.read sys.stdin.buffer.read read ans = main(Height, Width, XY) main(Height, Width, XY) ans Height, Width, M_ko = map(int, readline().split()) map(int, readline().split()) Height readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines M_ko = map(int, readline().split()) map(int, readline().split()) M_ko def main(Height, Width, XY):
    UP = 300010
    row = np.zeros(UP, np.int64)
    col = np.zeros(UP, np.int64)
    
    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        row[x] += 1
        col[y] += 1
    
    row_max = row.max()
    col_max = col.max()

    judge = np.sum(row == row_max) * np.sum(col == col_max)

    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        
        if (row[x] == row_max and col[y] == col_max):
            judge -= 1
    
    summ = row_max + col_max
    
    return (summ if judge else summ - 1) def main(Height, Width, XY):
    UP = 300010
    row = np.zeros(UP, np.int64)
    col = np.zeros(UP, np.int64)
    
    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        row[x] += 1
        col[y] += 1
    
    row_max = row.max()
    col_max = col.max()

    judge = np.sum(row == row_max) * np.sum(col == col_max)

    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        
        if (row[x] == row_max and col[y] == col_max):
            judge -= 1
    
    summ = row_max + col_max
    
    return (summ if judge else summ - 1) main
import numpy as np
import numba
import sys
from numba import njit, b1, i4, i8, f8

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


@njit((i8, i8, i8[:]), cache=True)
def main(Height, Width, XY):
    UP = 300010
    row = np.zeros(UP, np.int64)
    col = np.zeros(UP, np.int64)
    
    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        row[x] += 1
        col[y] += 1
    
    row_max = row.max()
    col_max = col.max()

    judge = np.sum(row == row_max) * np.sum(col == col_max)

    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        
        if (row[x] == row_max and col[y] == col_max):
            judge -= 1
    
    summ = row_max + col_max
    
    return (summ if judge else summ - 1)


Height, Width, M_ko = map(int, readline().split())
XY = np.array(read().split(), np.int64)

ans = main(Height, Width, XY)
print(ans)
